diff --git a/Docs/README.md b/Docs/README.md index 4332550..a748741 100644 --- a/Docs/README.md +++ b/Docs/README.md @@ -10,10 +10,12 @@ This folder contains the main project documentation for Agent Memory Toolkit. | [local_testing.md](local_testing.md) | Covers local setup, environment configuration, RBAC, Cosmos provisioning, running the toolkit and Azure Functions locally, and testing change feed auto-processing with serverless or autoscale container provisioning. | | [azure_testing.md](azure_testing.md) | Covers Azure deployment, cloud configuration, required services, change feed settings, throughput mode configuration, and validation steps for running the toolkit in Azure. | | [design_patterns.md](design_patterns.md) | Shows when and how to call CRUD operations, summarization, fact extraction, and memory retrieval in chat and multi-agent applications, including automatic processing via the change feed. | +| [troubleshooting.md](troubleshooting.md) | Helps diagnose common setup, authentication, Cosmos DB, embeddings, Durable Functions, vector search, and change feed issues. | ## Recommended Reading Order 1. Start with [concepts.md](concepts.md) to understand the data model and memory lifecycle. 2. Use [local_testing.md](local_testing.md) to get the toolkit running and validated on your machine. 3. Use [azure_testing.md](azure_testing.md) when you are ready to deploy or validate the full stack in Azure. -4. See [design_patterns.md](design_patterns.md) for integration patterns in real applications. \ No newline at end of file +4. See [design_patterns.md](design_patterns.md) for integration patterns in real applications. +5. Use [troubleshooting.md](troubleshooting.md) when setup, processing, search, or automatic change feed behavior does not work as expected. \ No newline at end of file diff --git a/Docs/troubleshooting.md b/Docs/troubleshooting.md new file mode 100644 index 0000000..818c341 --- /dev/null +++ b/Docs/troubleshooting.md @@ -0,0 +1,192 @@ +# Troubleshooting Agent Memory Toolkit + +Use this guide when local memory works but Cosmos DB, embeddings, Durable Functions, or automatic change feed processing does not. + +--- + +## Quick Triage + +| Symptom | First checks | +|---------|--------------| +| Import errors | Install with `pip install -e ".[dev]"` and import `CosmosMemoryClient` or `AsyncCosmosMemoryClient`. | +| Missing configuration | Verify `.env`, `function_app/local.settings.json`, and Azure Function App settings use the same endpoint, database, container, and AI deployment values. | +| Cosmos 401 or 403 | Run `az login` and confirm Cosmos DB data-plane RBAC is assigned. | +| Cosmos operations fail before connecting | Call `create_memory_store()` or `connect_cosmos()` before cloud operations. | +| Search returns no vector results | Confirm embeddings are generated and `AI_FOUNDRY_EMBEDDING_DIMENSIONS` matches the container vector policy. | +| Durable Functions processing fails | Start the Functions host and check `function_app/local.settings.json`, the change feed trigger, and the orchestrator logs. | +| Change feed does not create summaries or facts | Confirm change feed settings, thresholds, lease container, counter container, and that inserted documents have `type: "turn"`. | + +--- + +## 1. Environment And Imports + +Install the package from the repository root: + +```bash +pip install -e ".[dev]" +pip install -r function_app/requirements.txt +``` + +The public clients are: + +```python +from agent_memory_toolkit import CosmosMemoryClient +from agent_memory_toolkit.aio import AsyncCosmosMemoryClient +``` + +If notebooks cannot import the package, run them from the repo root with paths such as `Samples/Notebooks/Demo.ipynb`, or add the repository root to `sys.path`. + +--- + +## 2. Configuration And Authentication + +For local runs, keep `.env`, `function_app/local.settings.json`, and deployed Function App settings aligned: + +```env +COSMOS_DB_ENDPOINT=https://.documents.azure.com:443/ +COSMOS_DB__accountEndpoint=https://.documents.azure.com:443/ +COSMOS_DB_KEY= +COSMOS_DB_DATABASE=ai_memory +COSMOS_DB_CONTAINER=memories +COSMOS_DB_COUNTERS_CONTAINER=counter +COSMOS_DB_LEASE_CONTAINER=leases +COSMOS_DB_THROUGHPUT_MODE=serverless +COSMOS_DB_AUTOSCALE_MAX_RU=1000 + +AI_FOUNDRY_ENDPOINT=https://.openai.azure.com/ +AI_FOUNDRY_API_KEY= +AI_FOUNDRY_EMBEDDING_DEPLOYMENT_NAME=text-embedding-3-large +AI_FOUNDRY_EMBEDDING_DIMENSIONS=1536 +AI_FOUNDRY_EMBEDDING_DATA_TYPE=float32 +AI_FOUNDRY_EMBEDDING_DISTANCE_FUNCTION=cosine +AI_FOUNDRY_CHAT_DEPLOYMENT_NAME= +``` + +The notebooks and samples pass these values into the client like this: + +| `.env` setting | Client argument | +|---|---| +| `COSMOS_DB_ENDPOINT` | `cosmos_endpoint` | +| `COSMOS_DB_DATABASE` | `cosmos_database` | +| `COSMOS_DB_CONTAINER` | `cosmos_container` | +| `COSMOS_DB_COUNTERS_CONTAINER` | `cosmos_counter_container` | +| `COSMOS_DB_LEASE_CONTAINER` | `cosmos_lease_container` | +| `COSMOS_DB_KEY` | `cosmos_key` | +| `AI_FOUNDRY_ENDPOINT` | `ai_foundry_endpoint` | +| `AI_FOUNDRY_API_KEY` | `ai_foundry_api_key` | +| `AI_FOUNDRY_EMBEDDING_DEPLOYMENT_NAME` | `embedding_deployment_name` | +| `AI_FOUNDRY_CHAT_DEPLOYMENT_NAME` | `chat_deployment_name` | + +`AI_FOUNDRY_EMBEDDING_DIMENSIONS`, `AI_FOUNDRY_EMBEDDING_DATA_TYPE`, and `AI_FOUNDRY_EMBEDDING_DISTANCE_FUNCTION` are read by the toolkit when creating the Cosmos DB vector policy. The Function App also reads `COSMOS_DB__accountEndpoint` for its identity-based Cosmos DB trigger binding; set it to the same value as `COSMOS_DB_ENDPOINT`. + +Run `az login` before using `DefaultAzureCredential`. + +Required roles: + +| Service | Role | +|---------|------| +| Cosmos DB | Cosmos DB Built-in Data Contributor | +| Azure OpenAI / AI Services | Cognitive Services OpenAI User | + +RBAC changes can take several minutes to propagate. + +--- + +## 3. Cosmos DB Store Creation + +Run `create_memory_store()` before relying on cloud operations. It creates the database plus the `memories`, `counter`, and `leases` containers. + +The memories container is created with: + +- hierarchical partition key on `user_id` and `thread_id` +- vector index on `/embedding` +- full-text index on `/content` + +If vector or full-text search fails after changing dimensions or indexing settings, create a fresh container with the desired configuration. Cosmos container vector policies are creation-time infrastructure choices. + +Use `COSMOS_DB_THROUGHPUT_MODE=serverless` for the default setup. Use `autoscale` with `COSMOS_DB_AUTOSCALE_MAX_RU` when you need provisioned autoscale throughput. + +--- + +## 4. Embeddings And Search + +Embedding failures usually mean one of these is wrong: + +- `AI_FOUNDRY_ENDPOINT` +- `AI_FOUNDRY_EMBEDDING_DEPLOYMENT_NAME` +- `AI_FOUNDRY_EMBEDDING_DIMENSIONS` +- Azure OpenAI / AI Services RBAC + +For hybrid search, `search_terms` is required when `hybrid_search=True`. + +If search returns documents but scores look poor, check that records have an `embedding` field and that the query uses similar language to the stored memory content. + +--- + +## 5. Durable Functions Processing + +Durable Functions processing requires the Functions host. + +Start local dependencies: + +```bash +azurite --silent --location /tmp/azurite --debug /tmp/azurite/debug.log +cd function_app +func start +``` + +The SDK does not post to a Function endpoint. With `DurableFunctionProcessor`, the SDK writes turns to Cosmos DB and the deployed Function App picks them up from the Cosmos DB change feed. For local testing, keep `function_app/local.settings.json` aligned with `.env` and confirm the Functions host starts the change feed trigger. + +If orchestration polling times out, check the Functions logs first. The orchestration may still be running, or an activity may be waiting on Cosmos DB or the LLM endpoint. + +--- + +## 6. Change Feed Processing + +Automatic processing requires these settings in the Functions app or `local.settings.json`: + +```json +"COSMOS_DB__accountEndpoint": "https://.documents.azure.com:443/", +"COSMOS_DB_ENDPOINT": "https://.documents.azure.com:443/", +"COSMOS_DB_DATABASE": "ai_memory", +"COSMOS_DB_CONTAINER": "memories", +"COSMOS_DB_COUNTERS_CONTAINER": "counter", +"COSMOS_DB_LEASE_CONTAINER": "leases", +"AI_FOUNDRY_ENDPOINT": "https://.openai.azure.com/", +"AI_FOUNDRY_CHAT_DEPLOYMENT_NAME": "gpt-4o-mini", +"AI_FOUNDRY_EMBEDDING_DEPLOYMENT_NAME": "text-embedding-3-large", +"THREAD_SUMMARY_EVERY_N": "5", +"FACT_EXTRACTION_EVERY_N": "3", +"USER_SUMMARY_EVERY_N": "10" +``` + +Set a threshold to `"0"` to disable that processing type. + +Cosmos DB memory documents store their category in the JSON `type` field. Only documents with `type: "turn"` increment counters. Derived memories with `type: "summary"`, `type: "fact"`, or `type: "user_summary"` do not trigger threshold counts. + +If nothing fires: + +- verify the Functions host shows the Cosmos DB trigger +- confirm the `leases` container exists +- confirm the `counter` container is writable +- insert enough new turn documents to cross the configured threshold +- check for generated documents where the Cosmos JSON field is `type="summary"`, `type="fact"`, or `type="user_summary"` + +--- + +## 7. Async Client Notes + +Use async Azure credentials with the async client: + +```python +from azure.identity.aio import DefaultAzureCredential +from agent_memory_toolkit.aio import AsyncCosmosMemoryClient +``` + +Always `await` cloud operations and close the client when done: + +```python +await memory.close() +``` + +In notebooks, top-level `await` is supported, so do not wrap cells with `asyncio.run()`. \ No newline at end of file diff --git a/Overview.png b/Overview.png new file mode 100644 index 0000000..d34616c Binary files /dev/null and b/Overview.png differ diff --git a/README.md b/README.md index f182885..2898067 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Azure Cosmos DB Agent Memory Toolkit - Public Preview +![Agent Memory Toolkit overview](Overview.png) + + [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/) [![Azure Cosmos DB](https://img.shields.io/badge/Azure-Cosmos%20DB-0078D4?logo=microsoft-azure)](https://azure.microsoft.com/en-us/products/cosmos-db/) @@ -10,46 +13,6 @@ Agent Memory Toolkit is a Python SDK for storing, retrieving, and transforming agent memories on Azure Cosmos DB. It gives your agent both raw conversation history and higher-value derived memory — thread summaries, extracted facts, and cross-thread user profiles — all searchable semantically. The processing pipeline can run **in-process** (zero infra) or in a sibling **Azure Durable Function app** that watches the Cosmos DB change feed. Sync (`CosmosMemoryClient`) and async (`AsyncCosmosMemoryClient`) APIs are mirror-images of each other. -``` -┌──────────────────────────────────────────────────────────────────────────────────────┐ -│ YOUR AGENTIC APP │ -│ Uses CosmosMemoryClient / AsyncCosmosMemoryClient │ -└─────────────────────────────────────────┬────────────────────────────────────────────┘ - │ - ▼ -┌──────────────────────────────────────────────────────────────────────────────────────┐ -│ AGENT MEMORY TOOLKIT (Python SDK) │ -│ │ -│ • Local in-memory CRUD │ -│ • Cosmos DB storage and retrieval │ -│ • Pluggable processor: in-process or remote Durable Function app │ -└──────────────────────────────────────────┬──────────────────────────────┬────────────┘ - │ │ - │ read / write │ Invoke processing pipeline - ▼ ▼ -┌───────────────────────────────────┐ ┌──────────────────────────────────┐ -│ AZURE COSMOS DB (NoSQL) │ │ AZURE DURABLE FUNCTIONS │ -│ │ │ │ -│ Stores: │ │ Orchestrates memory processing: │ -│ • turns │ │ • thread summaries │ -│ • summaries │◄─── memory management ───►│ • fact extraction │ -│ • facts │ │ • user summaries │ -│ • user summaries │ │ │ -│ │ │ On-demand (SDK) or automatic │ -│ Supports query, vector, text │ change feed trigger │ (Cosmos DB change feed trigger). │ -│ search over stored memories. │───────────────────────────►│ │ -└───────────────────────┬───────────┘ └──────────────────┬───────────────┘ - │ embeddings and LLM-based processing │ - └──────────────────────┬───────────────────────────────────┘ - ▼ - ┌──────────────────────────────────┐ - │ MICROSOFT FOUNDRY │ - │ │ - │ • Embeddings for search │ - │ • Chat/LLM generation │ - │ │ - └──────────────────────────────────┘ -``` --- @@ -156,7 +119,7 @@ print(memory.get_user_summary(user_id=USER)) ### 4. Run a sample ```bash -python Samples/quickstart_cosmos.py +python Samples/Quickstarts/quickstart_cosmos.py ``` See [`Samples/`](Samples/) for end-to-end scenarios (chat memory, RAG, multi-agent, customer support, remote processor). @@ -273,6 +236,29 @@ memory = CosmosMemoryClient(..., processor=DurableFunctionProcessor()) --- +### Architecture overview + +``` ++--------------------------+ +| Agent app | ++------------+-------------+ + | + v ++--------------------------+ +--------------------------+ +| Agent Memory Toolkit | <--> | Microsoft Foundry | +| Python sync/async SDK | | LLMs + embeddings | ++------------+-------------+ +------------+-------------+ + ^ ^ + | | + v v ++--------------------------+ +--------------------------+ +| Azure Cosmos DB | <--> | Azure Durable Functions | +| memories + search | | optional processing | ++--------------------------+ +--------------------------+ +``` + +--- + ## Public API reference | Symbol | Module | Purpose | @@ -297,6 +283,7 @@ Async equivalents (`AsyncInProcessProcessor`, `AsyncDurableFunctionProcessor`) l - **[Docs/local_testing.md](Docs/local_testing.md)** — Prerequisites, environment setup, running locally, debugging - **[Docs/azure_testing.md](Docs/azure_testing.md)** — Azure deployment, RBAC, cloud validation - **[infra/README.md](infra/README.md)** — `azd` deployment, Bicep modules, BYOR settings, counter-trigger tuning +- **[Docs/troubleshooting.md](Docs/troubleshooting.md)** — Common issues and resolutions for setup, auth, Cosmos DB, embeddings, Durable Functions, vector search, change feed, etc. --- @@ -308,7 +295,7 @@ agent_memory_toolkit/ Python SDK (sync + aio mirror) function_app/ Sibling Azure Durable Function app infra/ Bicep modules + main.bicep for `azd up` azure.yaml `azd` config — provisions Cosmos + AI Foundry + Function app -Samples/ Demo notebooks + sample scripts +Samples/ Categorized demo notebooks + sample scripts Docs/ Conceptual + operational docs tests/ Unit + integration tests (pytest) ``` diff --git a/Samples/advanced_memory_lifecycle.py b/Samples/Advanced/advanced_memory_lifecycle.py similarity index 100% rename from Samples/advanced_memory_lifecycle.py rename to Samples/Advanced/advanced_memory_lifecycle.py diff --git a/Samples/advanced_search_patterns.py b/Samples/Advanced/advanced_search_patterns.py similarity index 100% rename from Samples/advanced_search_patterns.py rename to Samples/Advanced/advanced_search_patterns.py diff --git a/Samples/Demo.ipynb b/Samples/Demo.ipynb deleted file mode 100644 index f98a547..0000000 --- a/Samples/Demo.ipynb +++ /dev/null @@ -1,2991 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "080f4913", - "metadata": {}, - "source": [ - "# Agent Memory Toolkit – Demo\n", - "\n", - "This notebook walks through the **Agent Memory Toolkit** library using the synchronous `CosmosMemoryClient` class:\n", - "\n", - "1. **Setup** – Install dependencies and load environment variables\n", - "2. **Local memory operations** – `add_local`, `get_local`, `update_local`, `delete_local`\n", - "3. **Cosmos DB operations** – `add_cosmos`, `get_memories`, `get_thread`\n", - "4. **Thread Summary** – `generate_thread_summary()` (in-process LLM)\n", - "5. **Memory Extraction** – `extract_memories()` (facts + episodic + procedural)\n", - "6. **User Summary** – `generate_user_summary()` (cross-thread profile)\n", - "7. **Vector / hybrid search** – `search_cosmos()`\n", - "8. **Tagging, salience & deduplication** – tag mutation, salience filter, `reconcile()`\n", - "9. **Automatic processing (Change Feed)** – optional Azure Function for background processing\n", - "\n", - "> 💡 **Tip:** the synchronous `CosmosMemoryClient` accepts an optional `processor=` kwarg (defaults to `InProcessProcessor`). Pass `DurableFunctionProcessor()` to delegate summarization to the sibling Azure Function app — see `Samples/scenario_remote_processor.py`.\n" - ] - }, - { - "cell_type": "markdown", - "id": "4c72ab7a", - "metadata": {}, - "source": [ - "## 1. Setup\n", - "\n", - "Install/import dependencies and load environment variables from `.env`." - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "id": "843cc6f6", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:50:21.928709Z", - "start_time": "2026-05-04T19:50:21.527024Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:45.174774Z", - "iopub.status.busy": "2026-05-04T20:26:45.174674Z", - "iopub.status.idle": "2026-05-04T20:26:45.425206Z", - "shell.execute_reply": "2026-05-04T20:26:45.424817Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "COSMOS_DB_ENDPOINT: https://akataria-agent-memory-testing.documents.azure.com:443/\n", - "COSMOS_DB_DATABASE: ai_memory\n", - "COSMOS_DB_CONTAINER: memories\n", - "COSMOS_DB_COUNTERS_CONTAINER: counter\n", - "COSMOS_DB_LEASE_CONTAINER: leases\n", - "COSMOS_DB_THROUGHPUT_MODE: serverless\n", - "COSMOS_DB_AUTOSCALE_MAX_RU: 1000\n" - ] - } - ], - "source": [ - "import os, json\n", - "\n", - "from dotenv import load_dotenv\n", - "\n", - "from azure.identity import DefaultAzureCredential\n", - "\n", - "\n", - "\n", - "# Add parent directory to path so we can import the package easily\n", - "\n", - "import sys\n", - "\n", - "sys.path.insert(0, os.path.abspath(\"..\"))\n", - "\n", - "\n", - "\n", - "from agent_memory_toolkit import CosmosMemoryClient\n", - "\n", - "\n", - "\n", - "# Load environment variables from .env in the repo root\n", - "\n", - "load_dotenv(os.path.join(\"..\", \".env\"))\n", - "\n", - "\n", - "\n", - "print(\"COSMOS_DB_ENDPOINT:\", os.getenv(\"COSMOS_DB_ENDPOINT\"))\n", - "\n", - "print(\"COSMOS_DB_DATABASE:\", os.getenv(\"COSMOS_DB_DATABASE\"))\n", - "\n", - "print(\"COSMOS_DB_CONTAINER:\", os.getenv(\"COSMOS_DB_CONTAINER\"))\n", - "\n", - "print(\"COSMOS_DB_COUNTERS_CONTAINER:\", os.getenv(\"COSMOS_DB_COUNTERS_CONTAINER\", \"counter\"))\n", - "\n", - "print(\"COSMOS_DB_LEASE_CONTAINER:\", os.getenv(\"COSMOS_DB_LEASE_CONTAINER\", \"leases\"))\n", - "\n", - "print(\"COSMOS_DB_THROUGHPUT_MODE:\", os.getenv(\"COSMOS_DB_THROUGHPUT_MODE\", \"serverless\"))\n", - "\n", - "print(\"COSMOS_DB_AUTOSCALE_MAX_RU:\", os.getenv(\"COSMOS_DB_AUTOSCALE_MAX_RU\", \"1000\"))" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "bfc05f0f", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:50:26.577174Z", - "start_time": "2026-05-04T19:50:25.925102Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:45.426245Z", - "iopub.status.busy": "2026-05-04T20:26:45.426169Z", - "iopub.status.idle": "2026-05-04T20:26:45.930974Z", - "shell.execute_reply": "2026-05-04T20:26:45.930215Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "CosmosMemoryClient instance created\n", - "Throughput mode: serverless\n", - "Local memory store: []\n" - ] - } - ], - "source": [ - "# Create a CosmosMemoryClient instance.\n", - "# Credential priority: explicit cosmos_credential > explicit cosmos_key > DefaultAzureCredential.\n", - "# Set COSMOS_DB_KEY in your .env if you don't yet have control-plane RBAC (currently in private preview).\n", - "memory = CosmosMemoryClient(\n", - " cosmos_endpoint=os.getenv(\"COSMOS_DB_ENDPOINT\"),\n", - " cosmos_database=os.getenv(\"COSMOS_DB_DATABASE\"),\n", - " cosmos_container=os.getenv(\"COSMOS_DB_CONTAINER\"),\n", - " cosmos_counter_container=os.getenv(\"COSMOS_DB_COUNTERS_CONTAINER\", \"counter\"),\n", - " cosmos_lease_container=os.getenv(\"COSMOS_DB_LEASE_CONTAINER\", \"leases\"),\n", - " cosmos_throughput_mode=os.getenv(\"COSMOS_DB_THROUGHPUT_MODE\", \"serverless\"),\n", - " cosmos_autoscale_max_ru=int(os.getenv(\"COSMOS_DB_AUTOSCALE_MAX_RU\", \"1000\")),\n", - " cosmos_key=os.getenv(\"COSMOS_DB_KEY\"),\n", - " ai_foundry_endpoint=os.getenv(\"AI_FOUNDRY_ENDPOINT\"),\n", - " ai_foundry_api_key=os.getenv(\"AI_FOUNDRY_API_KEY\"),\n", - " embedding_deployment_name=os.getenv(\"AI_FOUNDRY_EMBEDDING_DEPLOYMENT_NAME\", \"text-embedding-3-large\"),\n", - " chat_deployment_name=os.getenv(\"AI_FOUNDRY_CHAT_DEPLOYMENT_NAME\", \"gpt-4o-mini\"),\n", - " use_default_credential=True,\n", - ")\n", - "\n", - "print(\"CosmosMemoryClient instance created\")\n", - "print(\"Throughput mode:\", os.getenv(\"COSMOS_DB_THROUGHPUT_MODE\", \"serverless\"))\n", - "print(\"Local memory store:\", memory.local_memory)\n" - ] - }, - { - "cell_type": "markdown", - "id": "630ce536", - "metadata": {}, - "source": [ - "## 2. Local Memory Operations\n", - "\n", - "### 2a. Add memories with `add_local`\n", - "\n", - "Each memory has a `user_id`, `role`, `content`, optional `type` (raw/summary/fact), and optional `metadata`." - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "d7c1bdc2", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:50:29.762172Z", - "start_time": "2026-05-04T19:50:29.732980Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:45.932875Z", - "iopub.status.busy": "2026-05-04T20:26:45.932737Z", - "iopub.status.idle": "2026-05-04T20:26:45.936154Z", - "shell.execute_reply": "2026-05-04T20:26:45.935563Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "User ID: user-09577899\n", - "Thread ID: e14d2b93-dbdc-46e7-99db-d3c916198047\n", - "\n" - ] - } - ], - "source": [ - "import uuid\n", - "THREAD_ID = str(uuid.uuid4())\n", - "# Use a unique user_id per demo run so we get a clean extraction without\n", - "# inheriting facts from prior runs that would dedup new content away.\n", - "USER_ID = f\"user-{uuid.uuid4().hex[:8]}\"\n", - "print(f\"User ID: {USER_ID}\")\n", - "print(f\"Thread ID: {THREAD_ID}\\n\")\n" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "8e5eafcd", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:50:31.130333Z", - "start_time": "2026-05-04T19:50:31.098819Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:45.937757Z", - "iopub.status.busy": "2026-05-04T20:26:45.937671Z", - "iopub.status.idle": "2026-05-04T20:26:45.945112Z", - "shell.execute_reply": "2026-05-04T20:26:45.944708Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Added 12 memories\n", - "[\n", - " {\n", - " \"id\": \"a54fd759-3890-4c76-a477-f34c1e1ef6da\",\n", - " \"user_id\": \"user-09577899\",\n", - " \"thread_id\": \"e14d2b93-dbdc-46e7-99db-d3c916198047\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"What's the weather like in Seattle this weekend?\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:26:45.942713+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"34f80709-d595-4a2d-b725-ba0b2fbed14e\",\n", - " \"user_id\": \"user-09577899\",\n", - " \"thread_id\": \"e14d2b93-dbdc-46e7-99db-d3c916198047\",\n", - " \"role\": \"agent\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"This weekend Seattle will be around 55\\u00b0F with partly cloudy skies on Saturday and light rain expected Sunday.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:26:45.942755+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"53301627-d160-47bd-bcdd-eff5901ac8d7\",\n", - " \"user_id\": \"user-09577899\",\n", - " \"thread_id\": \"e14d2b93-dbdc-46e7-99db-d3c916198047\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"That sounds nice enough. Can you help me book a trip to Seattle for this weekend?\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:26:45.942783+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"8a47c8f7-92ac-4819-8c9d-629cd3400a93\",\n", - " \"user_id\": \"user-09577899\",\n", - " \"thread_id\": \"e14d2b93-dbdc-46e7-99db-d3c916198047\",\n", - " \"role\": \"agent\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Sure! I found round-trip flights departing Friday evening and returning Sunday night. There are also several hotels in downtown Seattle with availability. Would you like me to look at specific airlines or neighborhoods?\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:26:45.942808+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"131015e6-1239-45ec-aec8-c4296bd62146\",\n", - " \"user_id\": \"user-09577899\",\n", - " \"thread_id\": \"e14d2b93-dbdc-46e7-99db-d3c916198047\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Something near Pike Place Market would be great. And keep the flights under $300 round trip if possible.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:26:45.942831+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"f01ae2bb-762f-415f-a45f-0772eee54523\",\n", - " \"user_id\": \"user-09577899\",\n", - " \"thread_id\": \"e14d2b93-dbdc-46e7-99db-d3c916198047\",\n", - " \"role\": \"agent\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"I found a round-trip on Alaska Airlines for $275 and two hotel options within a 5-minute walk of Pike Place Market: the Inn at the Market ($189/night) and a Hilton Garden Inn ($145/night). Want me to reserve one of these?\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:26:45.942855+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"fd18c1e3-9a53-4445-aced-43475091b16f\",\n", - " \"user_id\": \"user-09577899\",\n", - " \"thread_id\": \"e14d2b93-dbdc-46e7-99db-d3c916198047\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Whenever you book a flight for me, always book an aisle seat \\u2014 never a window or middle.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:26:45.942877+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"b47560e8-ccee-43b4-96ba-d50bc397c9ba\",\n", - " \"user_id\": \"user-09577899\",\n", - " \"thread_id\": \"e14d2b93-dbdc-46e7-99db-d3c916198047\",\n", - " \"role\": \"agent\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Got it. I'll always select an aisle seat for your bookings.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:26:45.942903+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"a1c02435-fcd4-4150-9c18-4267743e5173\",\n", - " \"user_id\": \"user-09577899\",\n", - " \"thread_id\": \"e14d2b93-dbdc-46e7-99db-d3c916198047\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"For trip planning, my workflow is: first check the weather for the destination, then check flights, then book the hotel last after everything else is confirmed.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:26:45.942927+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"fe6666fd-aa9d-41f9-ab17-a1fff6a530a3\",\n", - " \"user_id\": \"user-09577899\",\n", - " \"thread_id\": \"e14d2b93-dbdc-46e7-99db-d3c916198047\",\n", - " \"role\": \"agent\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Noted \\u2014 I'll follow that order: weather, then flights, then hotel.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:26:45.942951+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"f17b3408-455a-47e7-ad62-0670d4ea2915\",\n", - " \"user_id\": \"user-09577899\",\n", - " \"thread_id\": \"e14d2b93-dbdc-46e7-99db-d3c916198047\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"And never book me into anything that departs or arrives between midnight and 6am unless I explicitly approve it.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:26:45.942973+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"4be20fc0-477e-43a6-aef0-d7375d444031\",\n", - " \"user_id\": \"user-09577899\",\n", - " \"thread_id\": \"e14d2b93-dbdc-46e7-99db-d3c916198047\",\n", - " \"role\": \"agent\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Will do \\u2014 no overnight bookings without your explicit approval.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:26:45.942996+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " }\n", - "]\n", - "Rules thread ID: 49f67589-95eb-430b-a227-086987af20ae (8 turns)\n" - ] - } - ], - "source": [ - "# Add sample conversation: weather in Seattle → booking a trip (6 turns)\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", - " content=\"What's the weather like in Seattle this weekend?\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", - " content=\"This weekend Seattle will be around 55°F with partly cloudy skies on Saturday and light rain expected Sunday.\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", - " content=\"That sounds nice enough. Can you help me book a trip to Seattle for this weekend?\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", - " content=\"Sure! I found round-trip flights departing Friday evening and returning Sunday night. There are also several hotels in downtown Seattle with availability. Would you like me to look at specific airlines or neighborhoods?\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", - " content=\"Something near Pike Place Market would be great. And keep the flights under $300 round trip if possible.\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", - " content=\"I found a round-trip on Alaska Airlines for $275 and two hotel options within a 5-minute walk of Pike Place Market: the Inn at the Market ($189/night) and a Hilton Garden Inn ($145/night). Want me to reserve one of these?\",\n", - ")\n", - "\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", - " content=\"Whenever you book a flight for me, always book an aisle seat — never a window or middle.\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", - " content=\"Got it. I'll always select an aisle seat for your bookings.\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", - " content=\"For trip planning, my workflow is: first check the weather for the destination, then check flights, then book the hotel last after everything else is confirmed.\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", - " content=\"Noted — I'll follow that order: weather, then flights, then hotel.\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", - " content=\"And never book me into anything that departs or arrives between midnight and 6am unless I explicitly approve it.\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", - " content=\"Will do — no overnight bookings without your explicit approval.\",\n", - ")\n", - "\n", - "print(f\"Added {len(memory.local_memory)} memories\")\n", - "print(json.dumps(memory.get_local(), indent=2))\n", - "\n", - "# A second short thread of pure procedural-style instructions. Demonstrates\n", - "# that the extractor produces clean procedural items when the conversation is\n", - "# focused on rules/workflows rather than mixed with factual booking specifics.\n", - "RULES_THREAD_ID = str(uuid.uuid4())\n", - "for role, content in [\n", - " (\"user\", \"Whenever you book a flight for me, always book an aisle seat — never a window or middle.\"),\n", - " (\"agent\", \"Got it. I'll always select an aisle seat for your bookings.\"),\n", - " (\"user\", \"For trip planning, my workflow is: first check the weather, then check flights, and book the hotel last after everything else is confirmed.\"),\n", - " (\"agent\", \"Noted — I'll follow that order: weather, then flights, then hotel.\"),\n", - " (\"user\", \"Never book me into anything that departs or arrives between midnight and 6am unless I explicitly approve it.\"),\n", - " (\"agent\", \"Will do — no overnight bookings without your explicit approval.\"),\n", - " (\"user\", \"When picking a hotel, only recommend ones that include complimentary breakfast.\"),\n", - " (\"agent\", \"Understood — only hotels with complimentary breakfast.\"),\n", - "]:\n", - " memory.add_local(user_id=USER_ID, role=role, thread_id=RULES_THREAD_ID, content=content)\n", - "\n", - "print(f\"Rules thread ID: {RULES_THREAD_ID} ({sum(1 for m in memory.local_memory if m['thread_id']==RULES_THREAD_ID)} turns)\")\n" - ] - }, - { - "cell_type": "markdown", - "id": "cf15cfcf", - "metadata": {}, - "source": [ - "### 2b. Query memories with `get_local`\n", - "\n", - "Retrieve all memories, or filter by `memory_id`, `user_id`, `role`, or `memory_type`. Filters are combined with AND logic." - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "c58a71ce", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:50:34.927677Z", - "start_time": "2026-05-04T19:50:34.908938Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:45.946689Z", - "iopub.status.busy": "2026-05-04T20:26:45.946605Z", - "iopub.status.idle": "2026-05-04T20:26:45.949420Z", - "shell.execute_reply": "2026-05-04T20:26:45.948952Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Total memories: 20\n", - "\n", - "Memories for user-001: 20\n", - "Tool memories: 0\n", - "\n", - "Fact memories: 0\n", - "\n", - "Agent memories for user-001: 10\n" - ] - } - ], - "source": [ - "# Get all memories\n", - "all_memories = memory.get_local()\n", - "print(f\"Total memories: {len(all_memories)}\\n\")\n", - "\n", - "# Filter by user_id\n", - "user1_memories = memory.get_local(user_id=USER_ID)\n", - "print(f\"Memories for user-001: {len(user1_memories)}\")\n", - "\n", - "# Filter by role\n", - "tool_memories = memory.get_local(role=\"tool\")\n", - "print(f\"Tool memories: {len(tool_memories)}\")\n", - "for m in tool_memories:\n", - " print(f\" [{m['id'][:8]}...] {m['content'][:60]}\")\n", - "\n", - "# Filter by type\n", - "facts = memory.get_local(memory_types=[\"fact\"])\n", - "print(f\"\\nFact memories: {len(facts)}\")\n", - "for m in facts:\n", - " print(f\" [{m['id'][:8]}...] {m['content']}\")\n", - "\n", - "# Combine filters: user-001 + agent role\n", - "user1_agent = memory.get_local(user_id=USER_ID, role=\"agent\")\n", - "print(f\"\\nAgent memories for user-001: {len(user1_agent)}\")" - ] - }, - { - "cell_type": "markdown", - "id": "871b7cfa", - "metadata": {}, - "source": [ - "### 2c. Update a memory with `update_local`\n", - "\n", - "Update any combination of `content`, `role`, `memory_type`, or `metadata` for an existing memory by its `id`." - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "da42d953", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:50:37.601997Z", - "start_time": "2026-05-04T19:50:37.567424Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:45.950727Z", - "iopub.status.busy": "2026-05-04T20:26:45.950648Z", - "iopub.status.idle": "2026-05-04T20:26:45.953103Z", - "shell.execute_reply": "2026-05-04T20:26:45.952670Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Before update:\n", - "{\n", - " \"id\": \"131015e6-1239-45ec-aec8-c4296bd62146\",\n", - " \"user_id\": \"user-09577899\",\n", - " \"thread_id\": \"e14d2b93-dbdc-46e7-99db-d3c916198047\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Something near Pike Place Market would be great. And keep the flights under $300 round trip if possible.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:26:45.942831+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - "}\n", - "\n", - "After update:\n", - "{\n", - " \"id\": \"131015e6-1239-45ec-aec8-c4296bd62146\",\n", - " \"user_id\": \"user-09577899\",\n", - " \"thread_id\": \"e14d2b93-dbdc-46e7-99db-d3c916198047\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Something near Pike Place Market would be great. Keep flights under $300 round trip and hotels under $200/night.\",\n", - " \"metadata\": {\n", - " \"edited\": true,\n", - " \"reason\": \"user clarified hotel budget\"\n", - " },\n", - " \"created_at\": \"2026-05-04T20:26:45.942831+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000,\n", - " \"updated_at\": \"2026-05-04T20:26:45.951502+00:00\"\n", - "}\n" - ] - } - ], - "source": [ - "# Update the user's budget constraint to be more specific\n", - "target_id = memory.local_memory[4][\"id\"] # \"Something near Pike Place Market...\"\n", - "print(f\"Before update:\\n{json.dumps(memory.get_local(memory_id=target_id)[0], indent=2)}\\n\")\n", - "\n", - "memory.update_local(\n", - " memory_id=target_id,\n", - " content=\"Something near Pike Place Market would be great. Keep flights under $300 round trip and hotels under $200/night.\",\n", - " metadata={\"edited\": True, \"reason\": \"user clarified hotel budget\"},\n", - ")\n", - "print(f\"After update:\\n{json.dumps(memory.get_local(memory_id=target_id)[0], indent=2)}\")" - ] - }, - { - "cell_type": "markdown", - "id": "ab7b5085", - "metadata": {}, - "source": [ - "### 2d. Delete a memory with `delete_local`\n", - "\n", - "Remove a memory by its `id`." - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "8dea4bad", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:50:40.888339Z", - "start_time": "2026-05-04T19:50:40.858576Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:45.954501Z", - "iopub.status.busy": "2026-05-04T20:26:45.954409Z", - "iopub.status.idle": "2026-05-04T20:26:45.956864Z", - "shell.execute_reply": "2026-05-04T20:26:45.956501Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Deleting memory 53301627...\n", - "\n", - "Remaining memories: 19\n", - " [e14d2b93...] [a54fd759...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [e14d2b93...] [34f80709...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [e14d2b93...] [8a47c8f7...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [e14d2b93...] [131015e6...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [e14d2b93...] [f01ae2bb...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [e14d2b93...] [fd18c1e3...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [e14d2b93...] [b47560e8...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [e14d2b93...] [a1c02435...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [e14d2b93...] [fe6666fd...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [e14d2b93...] [f17b3408...] role=user type=turn And never book me into anything that departs or ar\n", - " [e14d2b93...] [4be20fc0...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [49f67589...] [5a6bffdb...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [49f67589...] [f5f9a65f...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [49f67589...] [5c70dee0...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [49f67589...] [5d2f37b4...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [49f67589...] [4ad08e53...] role=user type=turn Never book me into anything that departs or arrive\n", - " [49f67589...] [1bd931bb...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [49f67589...] [87019f1f...] role=user type=turn When picking a hotel, only recommend ones that inc\n", - " [49f67589...] [cb598c87...] role=agent type=turn Understood — only hotels with complimentary breakf\n" - ] - } - ], - "source": [ - "# Delete the tool memory (index 2 – the tool call)\n", - "tool_memory_id = memory.local_memory[2][\"id\"]\n", - "print(f\"Deleting memory {tool_memory_id[:8]}...\")\n", - "memory.delete_local(tool_memory_id)\n", - "\n", - "# Verify it's gone\n", - "print(f\"\\nRemaining memories: {len(memory.get_local())}\")\n", - "for m in memory.get_local():\n", - " print(f\" [{m['thread_id'][:8]}...] [{m['id'][:8]}...] role={m['role']:<6} type={m['type']:<8} {m['content'][:50]}\")" - ] - }, - { - "cell_type": "markdown", - "id": "c5fb8224", - "metadata": {}, - "source": [ - "## 3. Cosmos DB Operations\n", - "\n", - "### 3a. Cosmos DB Connection\n", - "\n", - "The client auto-connects to Cosmos DB when `cosmos_endpoint` is provided in the constructor. You can also call `connect_cosmos()` explicitly to reconnect or override connection parameters.\n", - "\n", - "> **Prerequisites:**\n", - "> - A Cosmos DB for NoSQL account with a database and container matching your `.env` values\n", - "> - The container should have a [vector embedding policy](https://learn.microsoft.com/azure/cosmos-db/nosql/vector-search) configured on the `embedding` field\n", - "> - Entra ID / managed identity RBAC role (e.g. *Cosmos DB Built-in Data Contributor*)\n", - "> - An Azure AI Foundry embedding model deployment for `add_cosmos` and `search_cosmos`" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "7ab2774c", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:50:43.406979Z", - "start_time": "2026-05-04T19:50:43.381359Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:45.958017Z", - "iopub.status.busy": "2026-05-04T20:26:45.957936Z", - "iopub.status.idle": "2026-05-04T20:26:45.959723Z", - "shell.execute_reply": "2026-05-04T20:26:45.959390Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Connected: True\n" - ] - } - ], - "source": [ - "# Already connected via constructor — call connect_cosmos() only if you need to reconnect\n", - "print(f\"Connected: {memory._container_client is not None}\")" - ] - }, - { - "cell_type": "markdown", - "id": "4b497000", - "metadata": {}, - "source": [ - "### 3b. Add memories to Cosmos DB with `add_cosmos`" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "940034e6", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:47:06.565165Z", - "start_time": "2026-05-04T19:47:06.416457Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:45.960747Z", - "iopub.status.busy": "2026-05-04T20:26:45.960690Z", - "iopub.status.idle": "2026-05-04T20:26:46.487278Z", - "shell.execute_reply": "2026-05-04T20:26:46.486386Z" - } - }, - "outputs": [], - "source": [ - "memory.push_to_cosmos()" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "35d972e3", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:50:44.709781Z", - "start_time": "2026-05-04T19:50:44.527683Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:46.490001Z", - "iopub.status.busy": "2026-05-04T20:26:46.489835Z", - "iopub.status.idle": "2026-05-04T20:26:46.651391Z", - "shell.execute_reply": "2026-05-04T20:26:46.650680Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "New Thread ID: bb7ca0ed-e4e6-4152-911d-57ce21ed751b\n", - "\n", - "Local memory count (should be unchanged): 19\n", - "\n", - "Memories in Cosmos DB for new thread: 5\n", - " [bb7ca0ed...] [8f712520...] role=user Can you recommend some good restaurants in New York City?\n", - " [bb7ca0ed...] [52eb7686...] role=tool {\"query\": \"top restaurants NYC\", \"results\": [\"Carbone\", \"Nob\n", - " [bb7ca0ed...] [dfea17c8...] role=agent Absolutely! NYC has incredible dining options. For Italian, \n", - " [bb7ca0ed...] [573b3124...] role=user I love Italian food. Are there any options that are budget-f\n", - " [bb7ca0ed...] [81c3abc7...] role=agent For budget-friendly Italian in NYC, check out L'industrie Pi\n" - ] - } - ], - "source": [ - "# Push a new thread directly to Cosmos DB without adding to local memory first\n", - "new_thread_id = str(uuid.uuid4())\n", - "print(f\"New Thread ID: {new_thread_id}\\n\")\n", - "\n", - "# Add memories directly to Cosmos DB using add_cosmos\n", - "memory.add_cosmos(\n", - " user_id=\"user-002\", role=\"user\", thread_id=new_thread_id,\n", - " content=\"Can you recommend some good restaurants in New York City?\",\n", - ")\n", - "memory.add_cosmos(\n", - " user_id=\"user-002\", role=\"tool\", thread_id=new_thread_id,\n", - " content='{\"query\": \"top restaurants NYC\", \"results\": [\"Carbone\", \"Nobu\", \"Katz\\'s Deli\", \"Le Bernardin\"]}',\n", - " metadata={\"tool_name\": \"restaurant_search\", \"tool_call_id\": \"call_abc123\"},\n", - ")\n", - "memory.add_cosmos(\n", - " user_id=\"user-002\", role=\"agent\", thread_id=new_thread_id,\n", - " content=\"Absolutely! NYC has incredible dining options. For Italian, try Carbone in Greenwich Village. For sushi, Nobu in Tribeca is world-class. For a classic NYC experience, Katz's Delicatessen on the Lower East Side is a must.\",\n", - ")\n", - "memory.add_cosmos(\n", - " user_id=\"user-002\", role=\"user\", thread_id=new_thread_id,\n", - " content=\"I love Italian food. Are there any options that are budget-friendly?\",\n", - ")\n", - "memory.add_cosmos(\n", - " user_id=\"user-002\", role=\"agent\", thread_id=new_thread_id,\n", - " content=\"For budget-friendly Italian in NYC, check out L'industrie Pizzeria in Williamsburg or Artichoke Basille's Pizza. Both are highly rated and won't break the bank.\",\n", - ")\n", - "\n", - "# Verify the memories were added directly to Cosmos DB (not in local memory)\n", - "print(f\"Local memory count (should be unchanged): {len(memory.local_memory)}\\n\")\n", - "\n", - "cosmos_results = memory.get_memories(user_id=\"user-002\", thread_id=new_thread_id)\n", - "print(f\"Memories in Cosmos DB for new thread: {len(cosmos_results)}\")\n", - "for r in cosmos_results:\n", - " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} {r['content'][:60]}\")" - ] - }, - { - "cell_type": "markdown", - "id": "40d603f1", - "metadata": {}, - "source": [ - "### 3c. Retrieve memories from Cosmos DB with `get_memories`\n", - "\n", - "Supports the same filters as `get_local`: `memory_id`, `user_id`, `role`, `memory_type`." - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "c953c0c6", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:50:46.986830Z", - "start_time": "2026-05-04T19:50:46.739178Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:46.653079Z", - "iopub.status.busy": "2026-05-04T20:26:46.652949Z", - "iopub.status.idle": "2026-05-04T20:26:46.794147Z", - "shell.execute_reply": "2026-05-04T20:26:46.793081Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Memories for user-001: 19\n", - "\n", - " [e14d2b93...] [a54fd759...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [e14d2b93...] [34f80709...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [e14d2b93...] [8a47c8f7...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [e14d2b93...] [131015e6...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [e14d2b93...] [f01ae2bb...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [e14d2b93...] [fd18c1e3...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [e14d2b93...] [b47560e8...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [e14d2b93...] [a1c02435...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [e14d2b93...] [fe6666fd...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [e14d2b93...] [f17b3408...] role=user type=turn And never book me into anything that departs or ar\n", - " [e14d2b93...] [4be20fc0...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [49f67589...] [5a6bffdb...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [49f67589...] [f5f9a65f...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [49f67589...] [5c70dee0...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [49f67589...] [5d2f37b4...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [49f67589...] [4ad08e53...] role=user type=turn Never book me into anything that departs or arrive\n", - " [49f67589...] [1bd931bb...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [49f67589...] [87019f1f...] role=user type=turn When picking a hotel, only recommend ones that inc\n", - " [49f67589...] [cb598c87...] role=agent type=turn Understood — only hotels with complimentary breakf\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "Agent memories: 331\n", - " [26f28370...] [3f04a33a...] role=agent type=turn The PNW has amazing trails like the Wonderland Tra\n", - " [26f28370...] [afebb21e...] role=agent type=turn Running is a great way to stay fit! Do you prefer \n", - " [26f28370...] [9b9a4a3b...] role=agent type=turn Python is very popular for AI/ML workloads. What f\n", - " [96f8868c...] [afbb20b5...] role=agent type=turn Got it! You're based in Seattle working at Microso\n", - " [96f8868c...] [c175440a...] role=agent type=turn 8 years of Python experience is impressive!\n", - " [96f8868c...] [ba7a7168...] role=agent type=turn That's a great area! LLMs combined with RAG can un\n", - " [5827e67c...] [d3497550...] role=agent type=turn Spring is a wonderful time to visit Japan! Cherry \n", - " [5827e67c...] [3edcb648...] role=agent type=turn 10–14 days lets you spend ~5 days in each city plu\n", - " [5827e67c...] [679afa68...] role=agent type=turn Japan has wonderful vegetarian options — try shoji\n", - " [5827e67c...] [44bc0998...] role=agent type=turn Shigetsu inside Tenryu-ji temple is famous for its\n", - " [bec477fa...] [3e65264f...] role=agent type=turn Try aglio e olio — pasta, garlic, olive oil, chill\n", - " [bec477fa...] [9c440b51...] role=agent type=turn Italian cuisine emphasises quality ingredients pre\n", - " [800e58b0...] [966440e7...] role=agent type=turn Great itinerary! Tuscany is amazing in autumn — wi\n", - " [800e58b0...] [3f8e2989...] role=agent type=turn Brunello di Montalcino producers offer wonderful c\n", - " [a3968726...] [900a8c86...] role=agent type=turn Azure Container Apps is a great fit for FastAPI.\n", - " [a3968726...] [91cc1977...] role=agent type=turn Azure has excellent AI services — AI Foundry, AI S\n", - " [09dc7d13...] [b8be927e...] role=agent type=turn That sounds exciting! Tokyo is wonderful in spring\n", - " [09dc7d13...] [f822061c...] role=agent type=turn Great choice! Try Ain Soph in Shinjuku for plant-b\n", - " [09dc7d13...] [4f82afee...] role=agent type=turn A Suica or Pasmo IC card is the easiest option. It\n", - " [6e44bfdf...] [554813b8...] role=agent type=turn Keep a consistent sleep schedule, avoid screens 1 \n", - " [6e44bfdf...] [de33c4e1...] role=agent type=turn Yes — caffeine has a half-life of about 5-6 hours,\n", - " [d78550ff...] [415b6b5a...] role=agent type=turn Of course! Last time we discussed Ain Soph in Shin\n", - " [ticket-d...] [7dff7796...] role=agent type=turn I'm sorry to hear that. Could you share when you b\n", - " [ticket-d...] [f518daf5...] role=agent type=turn Thanks. I'll check warranty status. Could you also\n", - " [ticket-d...] [32fd980e...] role=agent type=turn Verified — the device is under warranty. I've init\n", - " [ticket-7...] [505cdf04...] role=agent type=turn Welcome back, Alex! Yes, that confirms the diagnos\n", - " [ticket-7...] [c8fc1e0a...] role=agent type=turn The Surface Dock 2 or the Anker 778 are excellent \n", - " [ticket-d...] [cdf309ab...] role=agent type=turn Welcome back, Alex! Happy to help with your Micros\n", - " [a912fa55...] [fc43544b...] role=agent type=turn PLAN:\n", - " 1. Research manufacturing impact (battery \n", - " [a912fa55...] [c898a267...] role=agent type=turn FINDING 1 — Manufacturing: EV battery production e\n", - " [a912fa55...] [00f08077...] role=agent type=turn FINDING 2 — Energy source: EVs charged on renewabl\n", - " [a912fa55...] [c2242b74...] role=agent type=turn FINDING 3 — End-of-life: Li-ion battery recycling \n", - " [a912fa55...] [277aa203...] role=agent type=turn RECOMMENDATION: For urban fleets, battery-electric\n", - " [3283e3ce...] [3347c70d...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [3283e3ce...] [7325fcca...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [3283e3ce...] [d4c2d4b1...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [93f9f763...] [0eb2219f...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [93f9f763...] [d7de15e4...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [3e8c0348...] [1c85da9a...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [3e8c0348...] [95fd0352...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [3e8c0348...] [b63df7c7...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [cc7ba964...] [eab7a8dc...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [cc7ba964...] [043b1f73...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [bfaa7891...] [3ecd376a...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [bfaa7891...] [d78560d0...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [bfaa7891...] [168452e9...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [69b363f1...] [678aae82...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [69b363f1...] [1b9459b6...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [67df7d45...] [f48762ba...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [67df7d45...] [d922da49...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [67df7d45...] [ccdb6efc...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [49296007...] [eed6a8e5...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [49296007...] [495f8e55...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [0087a4c7...] [c8444bda...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [0087a4c7...] [83b493a7...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [0087a4c7...] [1ff00508...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [a62f6290...] [bb3e7800...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [a62f6290...] [926a875e...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [154bf409...] [799c324a...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [154bf409...] [3234f409...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [154bf409...] [e635815b...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [0fcdecee...] [c2f5d5a5...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [0fcdecee...] [cba4eb09...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [t1...] [2af2a94e...] role=agent type=turn Agent response\n", - " [78ada42c...] [26821e00...] role=agent type=turn That sounds exciting! Tokyo is wonderful in spring\n", - " [78ada42c...] [104974d7...] role=agent type=turn Great choice! Try Ain Soph in Shinjuku for plant-b\n", - " [78ada42c...] [caaa7d25...] role=agent type=turn A Suica or Pasmo IC card is the easiest option. It\n", - " [dd0ad3f9...] [81fe48ff...] role=agent type=turn Keep a consistent sleep schedule, avoid screens 1 \n", - " [dd0ad3f9...] [e5b990ab...] role=agent type=turn Yes — caffeine has a half-life of about 5-6 hours,\n", - " [a402c62b...] [426026b6...] role=agent type=turn Of course! Last time we discussed Ain Soph in Shin\n", - " [e2e2402e...] [d37cf5bf...] role=agent type=turn Spring is a wonderful time to visit Japan! Cherry \n", - " [e2e2402e...] [5eebb35c...] role=agent type=turn 10–14 days lets you spend ~5 days in each city plu\n", - " [e2e2402e...] [307dc427...] role=agent type=turn Japan has wonderful vegetarian options — try shoji\n", - " [e2e2402e...] [53e01cf6...] role=agent type=turn Shigetsu inside Tenryu-ji temple is famous for its\n", - " [thread-0...] [72aadb29...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [aa7d2515...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [77886873...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-4...] [3e7ac221...] role=agent type=turn Cosmos is great\n", - " [thread-4...] [5dc2cf5b...] role=agent type=turn yes DiskANN\n", - " [thread-4...] [99f7cf33...] role=agent type=turn colocates data\n", - " [thread-0...] [0349d4e5...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [efea8437...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [3bec5407...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [3cb84a20...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [57ea857b...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [0f628302...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [06666f17...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [548dd8a9...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [bd139b4f...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-2...] [02c7e958...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-2...] [6def8d60...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-0...] [b8db28d6...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [cbf0f0be...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [771971c9...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [80f6b374...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [c5c544d6...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [2c69aa14...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [b9161808...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [a27126d6...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [98e2d8de...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [805cf355...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [7c3af0fe...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [72cdd403...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-b...] [30296030...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-b...] [a64b3ad1...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [t1...] [8422cbfd...] role=agent type=turn Agent response\n", - " [d0421430...] [47eae793...] role=agent type=turn Got it! You're based in Seattle working at Microso\n", - " [d0421430...] [13017c8c...] role=agent type=turn 8 years of Python experience is impressive!\n", - " [d0421430...] [22d94ba6...] role=agent type=turn That's a great area! LLMs combined with RAG can un\n", - " [dd381d0c...] [8f58418d...] role=agent type=turn Spring is a wonderful time to visit Japan! Cherry \n", - " [dd381d0c...] [d7e35289...] role=agent type=turn 10–14 days lets you spend ~5 days in each city plu\n", - " [dd381d0c...] [46fda2e6...] role=agent type=turn Japan has wonderful vegetarian options — try shoji\n", - " [dd381d0c...] [de105f27...] role=agent type=turn Shigetsu inside Tenryu-ji temple is famous for its\n", - " [1a5388ca...] [f64a1f54...] role=agent type=turn Try aglio e olio — pasta, garlic, olive oil, chill\n", - " [1a5388ca...] [efb3613c...] role=agent type=turn Italian cuisine emphasises quality ingredients pre\n", - " [462c0b89...] [4e8648c0...] role=agent type=turn Great itinerary! Tuscany is amazing in autumn — wi\n", - " [462c0b89...] [1fe994b2...] role=agent type=turn Brunello di Montalcino producers offer wonderful c\n", - " [82849ac6...] [24cf1624...] role=agent type=turn Azure Container Apps is a great fit for FastAPI.\n", - " [82849ac6...] [7ea3e0ac...] role=agent type=turn Azure has excellent AI services — AI Foundry, AI S\n", - " [e9d75005...] [831c50e2...] role=agent type=turn The PNW has amazing trails like the Wonderland Tra\n", - " [e9d75005...] [3e754348...] role=agent type=turn Running is a great way to stay fit! Do you prefer \n", - " [e9d75005...] [2d8ad427...] role=agent type=turn Python is very popular for AI/ML workloads. What f\n", - " [75d8811b...] [f792c4e7...] role=agent type=turn That sounds exciting! Tokyo is wonderful in spring\n", - " [75d8811b...] [8a41f22a...] role=agent type=turn Great choice! Try Ain Soph in Shinjuku for plant-b\n", - " [75d8811b...] [20f5c5de...] role=agent type=turn A Suica or Pasmo IC card is the easiest option. It\n", - " [e8f0a465...] [efcc37f1...] role=agent type=turn Keep a consistent sleep schedule, avoid screens 1 \n", - " [e8f0a465...] [d1569024...] role=agent type=turn Yes — caffeine has a half-life of about 5-6 hours,\n", - " [45853aeb...] [2094ee58...] role=agent type=turn Of course! Last time we discussed Ain Soph in Shin\n", - " [ticket-9...] [6743a768...] role=agent type=turn I'm sorry to hear that. Could you share when you b\n", - " [ticket-9...] [5cf00dc0...] role=agent type=turn Thanks. I'll check warranty status. Could you also\n", - " [ticket-9...] [3aec4d8c...] role=agent type=turn Verified — the device is under warranty. I've init\n", - " [ticket-f...] [5d5a3234...] role=agent type=turn Welcome back, Alex! Yes, that confirms the diagnos\n", - " [ticket-f...] [e2aff8e0...] role=agent type=turn The Surface Dock 2 or the Anker 778 are excellent \n", - " [ticket-b...] [c8451dd2...] role=agent type=turn Welcome back, Alex! Happy to help with your Micros\n", - " [84350066...] [cc6e41cf...] role=agent type=turn PLAN:\n", - " 1. Research manufacturing impact (battery \n", - " [84350066...] [c8a01395...] role=agent type=turn FINDING 1 — Manufacturing: EV battery production e\n", - " [84350066...] [9a5c4e1d...] role=agent type=turn FINDING 2 — Energy source: EVs charged on renewabl\n", - " [84350066...] [6b1206fd...] role=agent type=turn FINDING 3 — End-of-life: Li-ion battery recycling \n", - " [84350066...] [25903ff0...] role=agent type=turn RECOMMENDATION: For urban fleets, battery-electric\n", - " [4c99b9ba...] [d1d42c19...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [4c99b9ba...] [6587d05b...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [4c99b9ba...] [f133d14c...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [73810c6b...] [4a24bc5a...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [73810c6b...] [6037ae5b...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [34249f73...] [eb3f86b6...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [34249f73...] [81d468be...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [34249f73...] [71a3704f...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [eb1efd30...] [d943c1a2...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [eb1efd30...] [fbf6a5a9...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [ae1eb483...] [a2d755ba...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ae1eb483...] [1eabf113...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [151e417e...] [00f1ec4f...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [151e417e...] [a49ad927...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [151e417e...] [374d57e5...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [75b607c1...] [18d7b346...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [75b607c1...] [22c624a7...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [18ec5623...] [20ddefe7...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [18ec5623...] [17a3e670...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [18ec5623...] [d53dad25...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [6514d03a...] [2fbee9d5...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [6514d03a...] [08f3076a...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [thread-0...] [1f6ffd63...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [3a203195...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [a92f4b54...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [6370552e...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [e38ecbee...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [72ddcc06...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-5...] [c3c713fa...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-5...] [c7364e90...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-3...] [c527bd97...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-3...] [7371ee6c...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-0...] [95d62050...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [be0085d4...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [c09230e7...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-c...] [3582eb74...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-c...] [598dff39...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [2dec0199...] [d53348b1...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [2dec0199...] [048b347d...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [2dec0199...] [f3b2e998...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [97d1c7d2...] [45d6f3eb...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [97d1c7d2...] [61ec5e9b...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [437580e8...] [741b0b83...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [437580e8...] [ebb06dba...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [9ed6e905...] [f200bbc0...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [9ed6e905...] [59877c89...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [9ed6e905...] [9a2a651c...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [9ed6e905...] [bfb488e8...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [9ed6e905...] [0d216b3d...] role=agent type=turn Understood — I'll confirm with you before booking \n", - " [9ed6e905...] [c9b3d5ab...] role=agent type=turn Will do. I'll filter hotel suggestions to only tho\n", - " [ede78157...] [d89aa694...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ede78157...] [bda83ce2...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [e2422aed...] [0cc39f4a...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [e2422aed...] [d2d28ce4...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [e2422aed...] [a0ebc75c...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [e2422aed...] [a07d551b...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [e2422aed...] [fac38202...] role=agent type=turn Will do. I'll filter hotel suggestions to only tho\n", - " [e2422aed...] [01b514c0...] role=agent type=turn Understood — I'll confirm with you before booking \n", - " [ba2753c5...] [f62c3be1...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ba2753c5...] [5f541c2a...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [d3a73355...] [7fc1a400...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [d3a73355...] [a895d314...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [d3a73355...] [05901836...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [d3a73355...] [a762cd26...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [d3a73355...] [81ce6316...] role=agent type=turn Understood — I'll confirm with you before booking \n", - " [d3a73355...] [86a404c9...] role=agent type=turn Will do. I'll filter hotel suggestions to only tho\n", - " [e9ed3070...] [9cf12919...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [e9ed3070...] [8712d011...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [92fcfce7...] [9b497f45...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [92fcfce7...] [2ac1f955...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [92fcfce7...] [340d4e33...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [92fcfce7...] [3a3d1544...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [92fcfce7...] [ba8c8d52...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [92fcfce7...] [2485f06d...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [26392a45...] [41f1ba4d...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [26392a45...] [54cf4894...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [f0fd9a78...] [7df1661f...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [f0fd9a78...] [1f84e8ac...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [f0fd9a78...] [034bd98c...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [f0fd9a78...] [9bc141ef...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [f0fd9a78...] [51227197...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [f0fd9a78...] [f6cd2184...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [5c3287a4...] [5955e0e9...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [5c3287a4...] [9866371e...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [b48abfd4...] [04627b70...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [b48abfd4...] [8cd6cac1...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [b48abfd4...] [b022017e...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [b48abfd4...] [83a30869...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [b48abfd4...] [1d2f503d...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [b48abfd4...] [a087dfa4...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [dbdc90d0...] [8aaead6f...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [dbdc90d0...] [e2e684e6...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [a1210ca7...] [8486acee...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [a1210ca7...] [1329afa7...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [a1210ca7...] [0712700a...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [a1210ca7...] [3a6887c4...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [a1210ca7...] [9c18002a...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [a1210ca7...] [7835ebd2...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [e97abcfc...] [c40acde3...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [e97abcfc...] [25890ac3...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [8f82e8c2...] [86395b5c...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [8f82e8c2...] [f810ee90...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [8f82e8c2...] [2c53284f...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [8f82e8c2...] [03f4f090...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [8f82e8c2...] [e61823c0...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [8f82e8c2...] [de44f072...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [925c1a31...] [1bc3a721...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [925c1a31...] [81c4308b...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [925c1a31...] [bbbce8be...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [925c1a31...] [490aeb85...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [1aba6dfb...] [67c9d6d2...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [1aba6dfb...] [f973d01f...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [df2c66e2...] [885e20a1...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [df2c66e2...] [a14e680c...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [df2c66e2...] [291b33d2...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [df2c66e2...] [0085b70d...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [ae1bb147...] [49f590c9...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [ae1bb147...] [36fc3840...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [df2c66e2...] [d2b63415...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [df2c66e2...] [293d9579...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [ae1bb147...] [6d68214d...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [ae1bb147...] [88479523...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [85e74267...] [32b3911a...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [85e74267...] [2594fb41...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [1a2686a2...] [72643b0a...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [1a2686a2...] [0ce72055...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [1a2686a2...] [c91a8397...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [1a2686a2...] [b0f0f031...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [1a2686a2...] [de786284...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [1a2686a2...] [863a0e92...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [6c5e0b18...] [9d94e048...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [6c5e0b18...] [b3cac85c...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [6c5e0b18...] [bce69f91...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [6c5e0b18...] [096d24da...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [ac8cf2db...] [e388f6c6...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ac8cf2db...] [ad4aa222...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [0df5b6dc...] [26681a8e...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [0df5b6dc...] [864f087a...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [0df5b6dc...] [0cdaa994...] role=agent type=turn Got it — aisle seats only.\n", - " [0df5b6dc...] [4f35ab5b...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [0df5b6dc...] [ab9e45ba...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [bc4a98cb...] [1076e63c...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [bc4a98cb...] [6ba1d437...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [bc4a98cb...] [fcf81c7c...] role=agent type=turn Got it — aisle seats only.\n", - " [bc4a98cb...] [45e487f4...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [bc4a98cb...] [1c81ae44...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [bdd72079...] [9a99982d...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [bdd72079...] [f17db44a...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [bdd72079...] [804c1f25...] role=agent type=turn Got it — aisle seats only.\n", - " [bdd72079...] [56d4e04b...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [bdd72079...] [9857a10d...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [42b91b2c...] [aee54464...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [42b91b2c...] [2610f0f2...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [42b91b2c...] [81e4ae3f...] role=agent type=turn Got it — aisle seats only.\n", - " [42b91b2c...] [88c29041...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [42b91b2c...] [aec0a2ba...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [e50f775e...] [88a718fa...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [e50f775e...] [5d25077d...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [e50f775e...] [4f8721a6...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [e50f775e...] [3f00a18c...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [e50f775e...] [4d4926ec...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [e50f775e...] [96aa9017...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [8f42e1b5...] [26ba3a10...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [8f42e1b5...] [2430022a...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [8f42e1b5...] [300757b0...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [8f42e1b5...] [c997e440...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [7b8fc78b...] [0e5d8a0a...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [7b8fc78b...] [c0437ffe...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [807c3bc6...] [c6b6827e...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [807c3bc6...] [101560c2...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [c1138077...] [30da082b...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [c1138077...] [40665284...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [807c3bc6...] [3ee542c4...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [807c3bc6...] [67cee94e...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [c1138077...] [2b7e104d...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [c1138077...] [4e5b3a7d...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [807c3bc6...] [97401d13...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [807c3bc6...] [3a42a459...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [6b59bbaf...] [6a66be86...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [6b59bbaf...] [546aff6a...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [e14d2b93...] [34f80709...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [e14d2b93...] [8a47c8f7...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [e14d2b93...] [f01ae2bb...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [e14d2b93...] [b47560e8...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [e14d2b93...] [fe6666fd...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [e14d2b93...] [4be20fc0...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [49f67589...] [f5f9a65f...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [49f67589...] [5d2f37b4...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [49f67589...] [1bd931bb...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [49f67589...] [cb598c87...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [bb7ca0ed...] [dfea17c8...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [bb7ca0ed...] [81c3abc7...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n" - ] - } - ], - "source": [ - "# Get all memories for user-001\n", - "results = memory.get_memories(user_id=USER_ID)\n", - "print(f\"Memories for user-001: {len(results)}\\n\")\n", - "for r in results:\n", - " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} type={r['type']:<8} {r['content'][:50]}\")\n", - "\n", - "# Get only agent memories\n", - "agent_results = memory.get_memories(role=\"agent\")\n", - "print(f\"\\nAgent memories: {len(agent_results)}\")\n", - "for r in agent_results:\n", - " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} type={r['type']:<8} {r['content'][:50]}\")" - ] - }, - { - "cell_type": "markdown", - "id": "167de1b9", - "metadata": {}, - "source": [ - "### 3d. Update & Delete in Cosmos DB\n", - "\n", - "`update_cosmos` and `delete_cosmos` work just like their local counterparts. If the content changes, the embedding is automatically re-generated." - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "1e41f9cb", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:50:51.818340Z", - "start_time": "2026-05-04T19:50:51.660999Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:46.796271Z", - "iopub.status.busy": "2026-05-04T20:26:46.796138Z", - "iopub.status.idle": "2026-05-04T20:26:46.891804Z", - "shell.execute_reply": "2026-05-04T20:26:46.890873Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Before: Something near Pike Place Market would be great. Keep flights under $300 round trip and hotels under $200/night.\n", - "\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "After: Something near Pike Place Market would be great. Keep flights under $300 round trip and hotels under $200/night.\n" - ] - } - ], - "source": [ - "# Update the user's budget message to add a hotel budget constraint\n", - "user_msgs = memory.get_memories(user_id=USER_ID, role=\"user\")\n", - "target = [m for m in user_msgs if \"Pike Place\" in m[\"content\"]][0]\n", - "print(f\"Before: {target['content']}\\n\")\n", - "\n", - "memory.update_cosmos(\n", - " memory_id=target[\"id\"],\n", - " content=\"Something near Pike Place Market would be great. Keep flights under $300 round trip and hotels under $200/night.\",\n", - " metadata={\"edited\": True, \"reason\": \"user clarified hotel budget\"},\n", - ")\n", - "\n", - "updated = memory.get_memories(memory_id=target[\"id\"])[0]\n", - "print(f\"After: {updated['content']}\")" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "f00ef033", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:50:53.902331Z", - "start_time": "2026-05-04T19:50:53.061878Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:46.893830Z", - "iopub.status.busy": "2026-05-04T20:26:46.893695Z", - "iopub.status.idle": "2026-05-04T20:26:50.409303Z", - "shell.execute_reply": "2026-05-04T20:26:50.408798Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'id': '52eb7686-6c58-4c0f-bfd4-2a5a3579e451', 'user_id': 'user-002', 'thread_id': 'bb7ca0ed-e4e6-4152-911d-57ce21ed751b', 'role': 'tool', 'type': 'turn', 'content': '{\"query\": \"top restaurants NYC\", \"results\": [\"Carbone\", \"Nobu\", \"Katz\\'s Deli\", \"Le Bernardin\"]}', 'metadata': {'tool_name': 'restaurant_search', 'tool_call_id': 'call_abc123'}, 'created_at': '2026-05-04T20:26:46.514321+00:00', 'tags': [], '_rid': 'EShyAMqZjm9qMjEBAAAAAA==', '_self': 'dbs/EShyAA==/colls/EShyAMqZjm8=/docs/EShyAMqZjm9qMjEBAAAAAA==/', '_etag': '\"00009606-0000-0800-0000-69f901060000\"', '_attachments': 'attachments/', '_ts': 1777926406}\n", - "Deleted tool memory 52eb7686...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "Remaining memories in Cosmos DB: 1061\n", - " [9060aacb...] [fact_31f...] role=system type=fact The user is building a recommendation engine for a\n", - " [9060aacb...] [fact_24c...] role=system type=fact The user chose a hybrid recommendation approach co\n", - " [9060aacb...] [fact_801...] role=system type=fact The user plans to use embeddings generated from bo\n", - " [9060aacb...] [fact_9e2...] role=system type=fact The user prefers Python for development.\n", - " [9060aacb...] [fact_d31...] role=system type=fact The user wants to use FastAPI for the API layer of\n", - " [9060aacb...] [ep_63631...] role=system type=episodic Last quarter, the user implemented a similar recom\n", - " [9060aacb...] [summary_...] role=system type=summary The user discussed building a hybrid recommendatio\n", - " [26f28370...] [050930c1...] role=user type=turn I love hiking in the Pacific Northwest\n", - " [26f28370...] [3f04a33a...] role=agent type=turn The PNW has amazing trails like the Wonderland Tra\n", - " [26f28370...] [1286f137...] role=user type=turn I usually run 5 miles every morning before work\n", - " [26f28370...] [afebb21e...] role=agent type=turn Running is a great way to stay fit! Do you prefer \n", - " [26f28370...] [9b9a4a3b...] role=agent type=turn Python is very popular for AI/ML workloads. What f\n", - " [96f8868c...] [6f2b06d0...] role=user type=turn I live in Seattle and work at Microsoft as a softw\n", - " [96f8868c...] [afbb20b5...] role=agent type=turn Got it! You're based in Seattle working at Microso\n", - " [96f8868c...] [f3ed4abc...] role=user type=turn My favourite programming language is Python and I'\n", - " [96f8868c...] [c175440a...] role=agent type=turn 8 years of Python experience is impressive!\n", - " [96f8868c...] [b14f468d...] role=user type=turn I'm currently working on a project involving large\n", - " [96f8868c...] [ba7a7168...] role=agent type=turn That's a great area! LLMs combined with RAG can un\n", - " [96f8868c...] [b10d9418...] role=user type=turn Last spring I went hiking on Mount Rainier with my\n", - " [96f8868c...] [8adba5c7...] role=user type=turn When debugging an LLM, always check the prompt fir\n", - " [96f8868c...] [fact_486...] role=system type=fact The user lives in Seattle.\n", - " [96f8868c...] [fact_c52...] role=system type=fact The user works at Microsoft as a software engineer\n", - " [96f8868c...] [fact_af9...] role=system type=fact The user's favorite programming language is Python\n", - " [96f8868c...] [fact_08a...] role=system type=fact The user has 8 years of experience using Python.\n", - " [96f8868c...] [fact_117...] role=system type=fact The user is currently working on a project involvi\n", - " [96f8868c...] [fact_ee1...] role=system type=fact The user has a dog.\n", - " [__proced...] [proc_616...] role=system type=procedural When debugging a large language model, always chec\n", - " [96f8868c...] [ep_13a6b...] role=system type=episodic Last spring, the user went hiking on Mount Rainier\n", - " [5827e67c...] [3782ffef...] role=user type=turn I'm planning a trip to Japan next spring. Any sugg\n", - " [5827e67c...] [d3497550...] role=agent type=turn Spring is a wonderful time to visit Japan! Cherry \n", - " [5827e67c...] [8717fe0d...] role=user type=turn I'd love to see Kyoto and Tokyo. How long should I\n", - " [5827e67c...] [3edcb648...] role=agent type=turn 10–14 days lets you spend ~5 days in each city plu\n", - " [5827e67c...] [summary_...] role=system type=summary The user planned a spring trip to Japan focused on\n", - " [5827e67c...] [30f39fca...] role=user type=turn What about food? I'm a vegetarian.\n", - " [5827e67c...] [679afa68...] role=agent type=turn Japan has wonderful vegetarian options — try shoji\n", - " [5827e67c...] [20418cbb...] role=user type=turn Are there any vegetarian restaurants you'd recomme\n", - " [5827e67c...] [44bc0998...] role=agent type=turn Shigetsu inside Tenryu-ji temple is famous for its\n", - " [bec477fa...] [410dcaf7...] role=user type=turn What's a good pasta recipe for a weeknight dinner?\n", - " [bec477fa...] [3e65264f...] role=agent type=turn Try aglio e olio — pasta, garlic, olive oil, chill\n", - " [bec477fa...] [93d8e2c1...] role=user type=turn Sounds great. I love simple Italian food, especial\n", - " [bec477fa...] [9c440b51...] role=agent type=turn Italian cuisine emphasises quality ingredients pre\n", - " [bec477fa...] [fact_584...] role=system type=fact The user prefers simple Italian food, especially d\n", - " [bec477fa...] [summary_...] role=system type=summary The conversation focused on suggesting a simple pa\n", - " [800e58b0...] [bc01e3d3...] role=user type=turn I want to visit Italy next year — Rome, Florence, \n", - " [800e58b0...] [966440e7...] role=agent type=turn Great itinerary! Tuscany is amazing in autumn — wi\n", - " [800e58b0...] [b1134253...] role=user type=turn Perfect — I love wine, especially Chianti and Brun\n", - " [800e58b0...] [3f8e2989...] role=agent type=turn Brunello di Montalcino producers offer wonderful c\n", - " [800e58b0...] [fact_bfd...] role=system type=fact The user plans to visit Italy next year, including\n", - " [800e58b0...] [fact_070...] role=system type=fact The user loves wine, especially Chianti and Brunel\n", - " [800e58b0...] [summary_...] role=system type=summary The user discussed plans to visit Italy next year,\n", - " [a3968726...] [80c78945...] role=user type=turn What's the best way to deploy a Python FastAPI app\n", - " [a3968726...] [900a8c86...] role=agent type=turn Azure Container Apps is a great fit for FastAPI.\n", - " [a3968726...] [00c996bc...] role=user type=turn Cool. I'm a Python engineer building AI tooling.\n", - " [a3968726...] [91cc1977...] role=agent type=turn Azure has excellent AI services — AI Foundry, AI S\n", - " [a3968726...] [fact_423...] role=system type=fact The user is a Python engineer building AI tooling.\n", - " [a3968726...] [summary_...] role=system type=summary The conversation focused on the best way to deploy\n", - " [__user_s...] [user_sum...] role=system type=user_summary The user is a Python engineer building AI tooling.\n", - " [09dc7d13...] [a313f4fe...] role=user type=turn Hi! I'm planning a trip to Tokyo next month.\n", - " [09dc7d13...] [b8be927e...] role=agent type=turn That sounds exciting! Tokyo is wonderful in spring\n", - " [09dc7d13...] [a048b3cd...] role=user type=turn I'd love food recommendations. I'm vegetarian.\n", - " [09dc7d13...] [f822061c...] role=agent type=turn Great choice! Try Ain Soph in Shinjuku for plant-b\n", - " [09dc7d13...] [6c05d0fc...] role=user type=turn Also, what's the best way to get around the city?\n", - " [09dc7d13...] [4f82afee...] role=agent type=turn A Suica or Pasmo IC card is the easiest option. It\n", - " [6e44bfdf...] [5f70d499...] role=user type=turn I've been having trouble sleeping lately. Any tips\n", - " [6e44bfdf...] [554813b8...] role=agent type=turn Keep a consistent sleep schedule, avoid screens 1 \n", - " [6e44bfdf...] [ceb47ce6...] role=user type=turn Does caffeine really affect sleep that much?\n", - " [6e44bfdf...] [de33c4e1...] role=agent type=turn Yes — caffeine has a half-life of about 5-6 hours,\n", - " [d78550ff...] [d78c85d4...] role=user type=turn Can you remind me of the Tokyo restaurant suggesti\n", - " [d78550ff...] [415b6b5a...] role=agent type=turn Of course! Last time we discussed Ain Soph in Shin\n", - " [ticket-d...] [d6a1be75...] role=user type=turn Hi, I'm having issues with my Surface Pro 9. The b\n", - " [ticket-d...] [7dff7796...] role=agent type=turn I'm sorry to hear that. Could you share when you b\n", - " [ticket-d...] [318d37d4...] role=user type=turn I bought it in March 2024 from the Microsoft Store\n", - " [ticket-d...] [f518daf5...] role=agent type=turn Thanks. I'll check warranty status. Could you also\n", - " [ticket-d...] [902ed190...] role=user type=turn It's alex.chen@example.com. The order number was M\n", - " [ticket-d...] [32fd980e...] role=agent type=turn Verified — the device is under warranty. I've init\n", - " [ticket-d...] [630500b2...] role=user type=turn OK, will do. By the way, I work as a software engi\n", - " [ticket-d...] [fact_b48...] role=system type=fact The user owns a Surface Pro 9 with a battery that \n", - " [ticket-d...] [fact_55f...] role=system type=fact The user purchased the Surface Pro 9 in March 2024\n", - " [ticket-d...] [fact_812...] role=system type=fact The user's email address is alex.chen@example.com.\n", - " [ticket-d...] [fact_68e...] role=system type=fact The Surface Pro 9 order number is MS-78234.\n", - " [ticket-d...] [fact_fe9...] role=system type=fact The user's Surface Pro 9 is currently under warran\n", - " [ticket-d...] [fact_198...] role=system type=fact The user works as a software engineer and relies o\n", - " [ticket-d...] [fact_369...] role=system type=fact The user will run the Surface app battery diagnost\n", - " [ticket-d...] [summary_...] role=system type=summary The user reported that their Surface Pro 9 battery\n", - " [ticket-7...] [59d28891...] role=user type=turn Hello again — Alex from the previous battery ticke\n", - " [ticket-7...] [505cdf04...] role=agent type=turn Welcome back, Alex! Yes, that confirms the diagnos\n", - " [ticket-7...] [4c3d1d55...] role=user type=turn Great. While we're talking, can you recommend a US\n", - " [ticket-7...] [c8fc1e0a...] role=agent type=turn The Surface Dock 2 or the Anker 778 are excellent \n", - " [ticket-7...] [f5cf5370...] role=user type=turn Multi-monitor is exactly what I need — I run 3 dis\n", - " [ticket-7...] [fact_032...] role=system type=fact The user's name is Alex.\n", - " [ticket-7...] [fact_ba5...] role=system type=fact The Surface app diagnostic reports that the user's\n", - " [ticket-7...] [fact_64c...] role=system type=fact Alex requires a USB-C dock compatible with the Sur\n", - " [ticket-7...] [summary_...] role=system type=summary Alex contacted support regarding a degraded batter\n", - " [__user_s...] [user_sum...] role=system type=user_summary The user's name is Alex.; The user's email address\n", - " [ticket-d...] [f6741f54...] role=user type=turn Hi, I have a quick question about my Microsoft 365\n", - " [ticket-d...] [cdf309ab...] role=agent type=turn Welcome back, Alex! Happy to help with your Micros\n", - " [a912fa55...] [975d78b5...] role=user type=turn Compare the environmental impact of electric vehic\n", - " [a912fa55...] [fc43544b...] role=agent type=turn PLAN:\n", - " 1. Research manufacturing impact (battery \n", - " [a912fa55...] [c898a267...] role=agent type=turn FINDING 1 — Manufacturing: EV battery production e\n", - " [a912fa55...] [00f08077...] role=agent type=turn FINDING 2 — Energy source: EVs charged on renewabl\n", - " [a912fa55...] [c2242b74...] role=agent type=turn FINDING 3 — End-of-life: Li-ion battery recycling \n", - " [a912fa55...] [277aa203...] role=agent type=turn RECOMMENDATION: For urban fleets, battery-electric\n", - " [thread-0...] [f844e873...] role=system type=fact User prefers Python over Java for backend work\n", - " [thread-0...] [d54ab12f...] role=system type=fact User is allergic to peanuts\n", - " [thread-0...] [24cf3d6a...] role=system type=fact User lives in Seattle, WA\n", - " [thread-0...] [323d880f...] role=system type=episodic Last Friday the user shipped a Cosmos-backed searc\n", - " [thread-0...] [b6c5a9ab...] role=system type=episodic User attended PyCon 2024 in Pittsburgh\n", - " [thread-0...] [b18fc854...] role=system type=procedural When the user says 'deploy', run `azd up` and tail\n", - " [thread-0...] [ce09b345...] role=system type=procedural Always confirm before purging Cosmos containers\n", - " [thread-5...] [fe918ee7...] role=system type=episodic Last Friday the user shipped a Cosmos-backed searc\n", - " [thread-5...] [31426409...] role=system type=episodic User attended PyCon 2024 in Pittsburgh\n", - " [thread-5...] [52d4d63f...] role=system type=procedural When the user says 'deploy', run `azd up` and tail\n", - " [thread-5...] [9ec66aac...] role=system type=procedural Always confirm before purging Cosmos containers\n", - " [3283e3ce...] [44e2a84b...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [3283e3ce...] [3347c70d...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [3283e3ce...] [7325fcca...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [3283e3ce...] [1548d960...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [3283e3ce...] [d4c2d4b1...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [93f9f763...] [b19855ba...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [93f9f763...] [0eb2219f...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [93f9f763...] [61ada8c9...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [93f9f763...] [d7de15e4...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [3283e3ce...] [summary_...] role=system type=summary The user planned a weekend trip to Seattle with sp\n", - " [3283e3ce...] [fact_6dd...] role=system type=fact For a weekend trip to Seattle, the user requires r\n", - " [3283e3ce...] [fact_7a7...] role=system type=fact For a weekend trip to Seattle, the user requires h\n", - " [3283e3ce...] [fact_07e...] role=system type=fact For a weekend trip to Seattle, the user prefers ac\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [9269dfde...] [6550cc6e...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [9269dfde...] [2b249321...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [9269dfde...] [ccced81a...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [3e8c0348...] [1c85da9a...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [3e8c0348...] [ad231b3b...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [3e8c0348...] [0eba1fb4...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [3e8c0348...] [95fd0352...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [3e8c0348...] [b63df7c7...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [cc7ba964...] [5a1dd03f...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [cc7ba964...] [eab7a8dc...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [cc7ba964...] [e353165a...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [cc7ba964...] [043b1f73...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [bfaa7891...] [1899de86...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [bfaa7891...] [3ecd376a...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [bfaa7891...] [d78560d0...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [bfaa7891...] [168452e9...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [bfaa7891...] [352b0816...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [69b363f1...] [12da5f11...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [69b363f1...] [678aae82...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [69b363f1...] [f282cce3...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [69b363f1...] [1b9459b6...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [67df7d45...] [f48762ba...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [67df7d45...] [d922da49...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [67df7d45...] [ccdb6efc...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [67df7d45...] [eece0053...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [67df7d45...] [78c59756...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [49296007...] [525fa21b...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [49296007...] [eed6a8e5...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [49296007...] [817d2b13...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [49296007...] [495f8e55...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [0087a4c7...] [7112974f...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [0087a4c7...] [c8444bda...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [0087a4c7...] [aca1086e...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [0087a4c7...] [83b493a7...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [0087a4c7...] [1ff00508...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [a62f6290...] [3ca18d6c...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [a62f6290...] [bb3e7800...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [a62f6290...] [9fd37b3a...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [a62f6290...] [926a875e...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [64930fb1...] [a67d7b29...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [64930fb1...] [2ccb8a00...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [64930fb1...] [10c23217...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [154bf409...] [c9f3116a...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [154bf409...] [799c324a...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [154bf409...] [3234f409...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [154bf409...] [e635815b...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [154bf409...] [c8dc5c13...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [0fcdecee...] [ddc8b396...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [0fcdecee...] [c2f5d5a5...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [0fcdecee...] [f03aa200...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [0fcdecee...] [cba4eb09...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [3283e3ce...] [ep_420f4...] role=system type=episodic The user was planning a weekend trip to Seattle an\n", - " [30b8b16c...] [913e5379...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [30b8b16c...] [e5e45fef...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [30b8b16c...] [08dddc67...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [t1...] [2af2a94e...] role=agent type=turn Agent response\n", - " [78ada42c...] [d288134a...] role=user type=turn Hi! I'm planning a trip to Tokyo next month.\n", - " [78ada42c...] [26821e00...] role=agent type=turn That sounds exciting! Tokyo is wonderful in spring\n", - " [78ada42c...] [bd2d2b5e...] role=user type=turn I'd love food recommendations. I'm vegetarian.\n", - " [78ada42c...] [104974d7...] role=agent type=turn Great choice! Try Ain Soph in Shinjuku for plant-b\n", - " [78ada42c...] [22e034f0...] role=user type=turn Also, what's the best way to get around the city?\n", - " [78ada42c...] [caaa7d25...] role=agent type=turn A Suica or Pasmo IC card is the easiest option. It\n", - " [dd0ad3f9...] [039bf606...] role=user type=turn I've been having trouble sleeping lately. Any tips\n", - " [dd0ad3f9...] [81fe48ff...] role=agent type=turn Keep a consistent sleep schedule, avoid screens 1 \n", - " [dd0ad3f9...] [5cb804de...] role=user type=turn Does caffeine really affect sleep that much?\n", - " [dd0ad3f9...] [e5b990ab...] role=agent type=turn Yes — caffeine has a half-life of about 5-6 hours,\n", - " [a402c62b...] [b5efa043...] role=user type=turn Can you remind me of the Tokyo restaurant suggesti\n", - " [a402c62b...] [426026b6...] role=agent type=turn Of course! Last time we discussed Ain Soph in Shin\n", - " [e2e2402e...] [a2ebd8fc...] role=user type=turn I'm planning a trip to Japan next spring. Any sugg\n", - " [e2e2402e...] [d37cf5bf...] role=agent type=turn Spring is a wonderful time to visit Japan! Cherry \n", - " [e2e2402e...] [e3e3d7ce...] role=user type=turn I'd love to see Kyoto and Tokyo. How long should I\n", - " [e2e2402e...] [5eebb35c...] role=agent type=turn 10–14 days lets you spend ~5 days in each city plu\n", - " [e2e2402e...] [summary_...] role=system type=summary The user planned a spring trip to Japan focused on\n", - " [e2e2402e...] [f194f077...] role=user type=turn What about food? I'm a vegetarian.\n", - " [e2e2402e...] [307dc427...] role=agent type=turn Japan has wonderful vegetarian options — try shoji\n", - " [e2e2402e...] [ba7e6fe2...] role=user type=turn Are there any vegetarian restaurants you'd recomme\n", - " [e2e2402e...] [53e01cf6...] role=agent type=turn Shigetsu inside Tenryu-ji temple is famous for its\n", - " [thread-0...] [f4734224...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [d5e42a3c...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [72aadb29...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [1cc0c040...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [aa7d2515...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [5eddb02b...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [77886873...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [6099050f...] role=system type=fact The user loves Azure Cosmos DB.\n", - " [thread-0...] [b0c0dd47...] role=system type=fact Azure Cosmos DB supports vector search powered by \n", - " [thread-0...] [summary_...] role=system type=summary The conversation consisted of brief exchanges abou\n", - " [thread-0...] [6bb1605b...] role=system type=fact Azure Cosmos DB supports hierarchical partition ke\n", - " [thread-4...] [a38d21e1...] role=user type=turn Hi I love Cosmos\n", - " [thread-4...] [3e7ac221...] role=agent type=turn Cosmos is great\n", - " [thread-4...] [8a13148e...] role=user type=turn vector search?\n", - " [thread-4...] [5dc2cf5b...] role=agent type=turn yes DiskANN\n", - " [thread-4...] [f555f850...] role=user type=turn HPK?\n", - " [thread-4...] [99f7cf33...] role=agent type=turn colocates data\n", - " [thread-4...] [summary_...] role=system type=summary The conversation briefly touched on Microsoft Azur\n", - " [thread-0...] [58d255e2...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [0349d4e5...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [13a6491b...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [efea8437...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [8ce337ef...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [3bec5407...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-9...] [bc800311...] role=user type=turn I'm planning a hiking trip to Olympic National Par\n", - " [__user_s...] [user_sum...] role=system type=user_summary The user lives in Seattle, WA.; The user is allerg\n", - " [thread-0...] [aa91e94e...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [3cb84a20...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [02c03996...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [57ea857b...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [9055c362...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [0f628302...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [793a5ee5...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [06666f17...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [d208eeea...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [548dd8a9...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [978dcff8...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [bd139b4f...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-2...] [79fca8cc...] role=user type=turn I'm planning a hiking trip to Olympic National Par\n", - " [thread-2...] [02c7e958...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-2...] [89959614...] role=user type=turn I'd like to camp 2 nights. Any permit guidance?\n", - " [thread-2...] [6def8d60...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-2...] [8b910b34...] role=user type=turn Thanks — also, I'm vegetarian, please remember tha\n", - " [thread-2...] [summary_...] role=system type=summary The user discussed planning a hiking and camping t\n", - " [thread-2...] [fact_0c0...] role=system type=fact The user is planning a hiking trip to Olympic Nati\n", - " [thread-2...] [fact_206...] role=system type=fact The user plans to camp for two nights during the O\n", - " [thread-2...] [fact_b39...] role=system type=fact The user follows a vegetarian diet.\n", - " [test-thr...] [3c31c8da...] role=user type=turn Test message 214ecc\n", - " [test-thr...] [9380bb97...] role=user type=turn Test message 6e6446\n", - " [test-thr...] [1944068a...] role=user type=turn Test message 0eff02\n", - " [test-thr...] [summary_...] role=system type=summary The user sent three short test messages containing\n", - " [e9cdb066...] [fact_ade...] role=system type=fact The user lives in Seattle.\n", - " [e9cdb066...] [fact_716...] role=system type=fact The user works at Microsoft as a software engineer\n", - " [e9cdb066...] [fact_cfe...] role=system type=fact The user prefers Python over JavaScript for backen\n", - " [__proced...] [proc_6a4...] role=system type=procedural When asked about deployment, always check the reso\n", - " [e9cdb066...] [ep_4a734...] role=system type=episodic The user traveled to Japan during cherry blossom s\n", - " [5672dff1...] [summary_...] role=system type=summary The user shared details about their daily running \n", - " [f28bdc49...] [summary_...] role=system type=summary The user shared their enthusiasm for Italian cooki\n", - " [5672dff1...] [fact_8da...] role=system type=fact The user goes running every morning before work, c\n", - " [f28bdc49...] [fact_512...] role=system type=fact The user loves Italian cooking, especially pasta.\n", - " [f28bdc49...] [fact_661...] role=system type=fact The user makes homemade fettuccine every weekend.\n", - " [test-thr...] [e8afd5dd...] role=user type=turn Test message ac3aa2\n", - " [test-thr...] [ecce99ca...] role=user type=turn Test message 15ec87\n", - " [test-thr...] [a43a8567...] role=user type=turn Test message fca3a8\n", - " [test-thr...] [summary_...] role=system type=summary The user sent three separate test messages contain\n", - " [test-thr...] [94c5afad...] role=user type=turn Test message e4a27e\n", - " [test-thr...] [476a9588...] role=user type=turn Test message 330890\n", - " [test-thr...] [4bdf8f28...] role=user type=turn Test message 506cf6\n", - " [test-thr...] [summary_...] role=system type=summary The conversation consisted of three standalone tes\n", - " [5622a10b...] [fact_cb8...] role=system type=fact The user lives in Seattle.\n", - " [5622a10b...] [fact_493...] role=system type=fact The user works at Microsoft as a software engineer\n", - " [5622a10b...] [fact_a13...] role=system type=fact The user prefers Python over JavaScript for backen\n", - " [__proced...] [proc_1f4...] role=system type=procedural When discussing deployment, always check the resou\n", - " [5622a10b...] [ep_0d448...] role=system type=episodic The user traveled to Japan during cherry blossom s\n", - " [c90da0a1...] [summary_...] role=system type=summary The conversation was a brief exchange about the us\n", - " [c90da0a1...] [fact_e6a...] role=system type=fact The user loves Italian cooking, especially pasta.\n", - " [c90da0a1...] [fact_d86...] role=system type=fact The user makes homemade fettuccine every weekend.\n", - " [thread-0...] [3771c68f...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [b8db28d6...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [8f280507...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [cbf0f0be...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [7bc1a0bd...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [771971c9...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [638e47a9...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [80f6b374...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [7207f7da...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [c5c544d6...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [ec28abb0...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [2c69aa14...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [test-thr...] [eb09e3b8...] role=user type=turn Test message c67925\n", - " [test-thr...] [390f2924...] role=user type=turn Test message 5c0bc7\n", - " [test-thr...] [9c356b00...] role=user type=turn Test message 075f33\n", - " [test-thr...] [summary_...] role=system type=summary The user sent three separate test messages contain\n", - " [c60acfe1...] [fact_9eb...] role=system type=fact The user lives in Seattle.\n", - " [c60acfe1...] [fact_a13...] role=system type=fact The user works at Microsoft as a software engineer\n", - " [c60acfe1...] [fact_6e6...] role=system type=fact The user prefers Python over JavaScript for backen\n", - " [__proced...] [proc_699...] role=system type=procedural When discussing deployment, always check the resou\n", - " [c60acfe1...] [ep_a1e72...] role=system type=episodic The user traveled to Japan during cherry blossom s\n", - " [08a365ae...] [fact_d32...] role=system type=fact The user makes homemade fettuccine every weekend.\n", - " [08a365ae...] [summary_...] role=system type=summary The user shared their enthusiasm for Italian cooki\n", - " [4d28c3df...] [fact_b23...] role=system type=fact The user runs approximately 5 kilometres each day.\n", - " [4d28c3df...] [summary_...] role=system type=summary The conversation was about the user’s daily runnin\n", - " [test-thr...] [3cb4cee8...] role=user type=turn Test message 396b1a\n", - " [test-thr...] [ee9ba6ab...] role=user type=turn Test message ce1cff\n", - " [test-thr...] [0c4ad50f...] role=user type=turn Test message 35de30\n", - " [test-thr...] [summary_...] role=system type=summary The conversation consisted of three short test mes\n", - " [6a0c8737...] [fact_318...] role=system type=fact The user lives in Seattle.\n", - " [6a0c8737...] [fact_c00...] role=system type=fact The user works at Microsoft as a software engineer\n", - " [6a0c8737...] [fact_234...] role=system type=fact The user prefers Python over JavaScript for backen\n", - " [__proced...] [proc_1f2...] role=system type=procedural When asked about deployment, always check the reso\n", - " [6a0c8737...] [ep_b5220...] role=system type=episodic The user traveled to Japan during cherry blossom s\n", - " [a8ea2e65...] [fact_7b9...] role=system type=fact The user goes running every morning before work, t\n", - " [8216c24f...] [fact_31f...] role=system type=fact The user enjoys Italian cooking, especially pasta \n", - " [8216c24f...] [fact_7ba...] role=system type=fact The user makes homemade fettuccine every weekend.\n", - " [cc830eaa...] [fact_7d5...] role=system type=fact The user has a golden retriever named Buddy.\n", - " [cc830eaa...] [fact_b66...] role=system type=fact Buddy is 3 years old.\n", - " [cc830eaa...] [fact_8b1...] role=system type=fact Buddy loves playing fetch at the park.\n", - " [thread-0...] [f4d39b04...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [b9161808...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [c3a74683...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [a27126d6...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [91c3e7dc...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [98e2d8de...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [cd0271bc...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [805cf355...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [826c773c...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [7c3af0fe...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [012f758c...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [72cdd403...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-b...] [9b72c25d...] role=user type=turn I'm planning a hiking trip to Olympic National Par\n", - " [thread-b...] [30296030...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-b...] [efabc25b...] role=user type=turn I'd like to camp 2 nights. Any permit guidance?\n", - " [thread-b...] [a64b3ad1...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-b...] [105b6260...] role=user type=turn Thanks — also, I'm vegetarian, please remember tha\n", - " [thread-b...] [summary_...] role=system type=summary The user discussed planning a hiking trip to Olymp\n", - " [t1...] [b7bbcd71...] role=user type=turn Hello from quickstart!\n", - " [t1...] [8422cbfd...] role=agent type=turn Agent response\n", - " [d0421430...] [5cb583cf...] role=user type=turn I live in Seattle and work at Microsoft as a softw\n", - " [d0421430...] [47eae793...] role=agent type=turn Got it! You're based in Seattle working at Microso\n", - " [d0421430...] [7ae79706...] role=user type=turn My favourite programming language is Python and I'\n", - " [d0421430...] [13017c8c...] role=agent type=turn 8 years of Python experience is impressive!\n", - " [d0421430...] [76abf10b...] role=user type=turn I'm currently working on a project involving large\n", - " [d0421430...] [22d94ba6...] role=agent type=turn That's a great area! LLMs combined with RAG can un\n", - " [d0421430...] [5b337ad5...] role=user type=turn Last spring I went hiking on Mount Rainier with my\n", - " [d0421430...] [b019f3b9...] role=user type=turn When debugging an LLM, always check the prompt fir\n", - " [d0421430...] [fact_ab2...] role=system type=fact The user lives in Seattle.\n", - " [d0421430...] [fact_f60...] role=system type=fact The user works at Microsoft as a software engineer\n", - " [d0421430...] [fact_0f6...] role=system type=fact The user's favourite programming language is Pytho\n", - " [d0421430...] [fact_83f...] role=system type=fact The user has 8 years of experience using Python.\n", - " [d0421430...] [fact_606...] role=system type=fact The user is currently working on a project involvi\n", - " [__proced...] [proc_1d3...] role=system type=procedural When debugging a large language model, always chec\n", - " [d0421430...] [ep_c4c50...] role=system type=episodic Last spring, the user went hiking on Mount Rainier\n", - " [dd381d0c...] [8a755754...] role=user type=turn I'm planning a trip to Japan next spring. Any sugg\n", - " [dd381d0c...] [8f58418d...] role=agent type=turn Spring is a wonderful time to visit Japan! Cherry \n", - " [dd381d0c...] [59506060...] role=user type=turn I'd love to see Kyoto and Tokyo. How long should I\n", - " [dd381d0c...] [d7e35289...] role=agent type=turn 10–14 days lets you spend ~5 days in each city plu\n", - " [d0421430...] [summary_...] role=system type=summary The user shared personal and professional backgrou\n", - " [d0421430...] [fact_58d...] role=system type=fact The user's favorite programming language is Python\n", - " [d0421430...] [fact_9de...] role=system type=fact The user is currently working on a project involvi\n", - " [d0421430...] [ep_918b6...] role=system type=episodic Last spring, the user went hiking on Mount Rainier\n", - " [dd381d0c...] [summary_...] role=system type=summary The user planned a spring trip to Japan focused on\n", - " [dd381d0c...] [50dd67ed...] role=user type=turn What about food? I'm a vegetarian.\n", - " [dd381d0c...] [46fda2e6...] role=agent type=turn Japan has wonderful vegetarian options — try shoji\n", - " [dd381d0c...] [747e073c...] role=user type=turn Are there any vegetarian restaurants you'd recomme\n", - " [dd381d0c...] [de105f27...] role=agent type=turn Shigetsu inside Tenryu-ji temple is famous for its\n", - " [dd381d0c...] [fact_982...] role=system type=fact The user is planning a trip to Japan next spring.\n", - " [dd381d0c...] [fact_cd7...] role=system type=fact The user wants to visit Kyoto and Tokyo during the\n", - " [dd381d0c...] [fact_555...] role=system type=fact The user follows a vegetarian diet.\n", - " [1a5388ca...] [553b498c...] role=user type=turn What's a good pasta recipe for a weeknight dinner?\n", - " [1a5388ca...] [f64a1f54...] role=agent type=turn Try aglio e olio — pasta, garlic, olive oil, chill\n", - " [1a5388ca...] [fa9e29e3...] role=user type=turn Sounds great. I love simple Italian food, especial\n", - " [1a5388ca...] [efb3613c...] role=agent type=turn Italian cuisine emphasises quality ingredients pre\n", - " [1a5388ca...] [fact_aa1...] role=system type=fact The user prefers simple Italian food made with fre\n", - " [1a5388ca...] [fact_088...] role=system type=fact The user loves simple Italian food, especially dis\n", - " [1a5388ca...] [summary_...] role=system type=summary The user asked for a good weeknight pasta recipe a\n", - " [462c0b89...] [5148d545...] role=user type=turn I want to visit Italy next year — Rome, Florence, \n", - " [462c0b89...] [4e8648c0...] role=agent type=turn Great itinerary! Tuscany is amazing in autumn — wi\n", - " [462c0b89...] [aedd2520...] role=user type=turn Perfect — I love wine, especially Chianti and Brun\n", - " [462c0b89...] [1fe994b2...] role=agent type=turn Brunello di Montalcino producers offer wonderful c\n", - " [462c0b89...] [fact_82d...] role=system type=fact The user plans to visit Italy next year, including\n", - " [462c0b89...] [fact_bf6...] role=system type=fact The user loves wine, especially Chianti and Brunel\n", - " [462c0b89...] [summary_...] role=system type=summary The user discussed plans to visit Italy next year,\n", - " [82849ac6...] [56c4c3c3...] role=user type=turn What's the best way to deploy a Python FastAPI app\n", - " [82849ac6...] [24cf1624...] role=agent type=turn Azure Container Apps is a great fit for FastAPI.\n", - " [82849ac6...] [99893621...] role=user type=turn Cool. I'm a Python engineer building AI tooling.\n", - " [82849ac6...] [7ea3e0ac...] role=agent type=turn Azure has excellent AI services — AI Foundry, AI S\n", - " [82849ac6...] [fact_dad...] role=system type=fact The user is a Python engineer building AI tooling.\n", - " [__user_s...] [user_sum...] role=system type=user_summary The user is a Python engineer.; The user is buildi\n", - " [82849ac6...] [summary_...] role=system type=summary The user asked about the best way to deploy a Pyth\n", - " [de98eb46...] [summary_...] role=system type=summary The user discussed building a hybrid recommendatio\n", - " [de98eb46...] [fact_5e8...] role=system type=fact The user is building a recommendation engine for a\n", - " [de98eb46...] [fact_c9e...] role=system type=fact The user chose a hybrid recommendation approach us\n", - " [de98eb46...] [fact_f77...] role=system type=fact The user prefers Python and plans to use FastAPI f\n", - " [de98eb46...] [ep_3a65f...] role=system type=episodic Last quarter, the user implemented a recommendatio\n", - " [de98eb46...] [fact_3a9...] role=system type=fact The user plans to implement a hybrid recommendatio\n", - " [de98eb46...] [fact_9d1...] role=system type=fact The user intends to use embeddings on book descrip\n", - " [e9d75005...] [c3b41618...] role=user type=turn I love hiking in the Pacific Northwest\n", - " [e9d75005...] [831c50e2...] role=agent type=turn The PNW has amazing trails like the Wonderland Tra\n", - " [de98eb46...] [fact_a37...] role=system type=fact The user prefers Python for development.\n", - " [de98eb46...] [fact_15f...] role=system type=fact The user wants to use FastAPI for the API layer of\n", - " [de98eb46...] [ep_53f68...] role=system type=episodic Last quarter, the user implemented a similar recom\n", - " [e9d75005...] [88803076...] role=user type=fact My favorite food is sushi, especially salmon nigir\n", - " [e9d75005...] [820486f6...] role=user type=turn I usually run 5 miles every morning before work\n", - " [e9d75005...] [3e754348...] role=agent type=turn Running is a great way to stay fit! Do you prefer \n", - " [e9d75005...] [d983c7e3...] role=user type=fact I work as a software engineer at a startup in Seat\n", - " [e9d75005...] [a001039f...] role=user type=fact My preferred programming language is Python\n", - " [e9d75005...] [2d8ad427...] role=agent type=turn Python is very popular for AI/ML workloads. What f\n", - " [75d8811b...] [b6b19602...] role=user type=turn Hi! I'm planning a trip to Tokyo next month.\n", - " [75d8811b...] [f792c4e7...] role=agent type=turn That sounds exciting! Tokyo is wonderful in spring\n", - " [75d8811b...] [17ccb199...] role=user type=turn I'd love food recommendations. I'm vegetarian.\n", - " [75d8811b...] [8a41f22a...] role=agent type=turn Great choice! Try Ain Soph in Shinjuku for plant-b\n", - " [75d8811b...] [532d93ee...] role=user type=turn Also, what's the best way to get around the city?\n", - " [75d8811b...] [20f5c5de...] role=agent type=turn A Suica or Pasmo IC card is the easiest option. It\n", - " [e8f0a465...] [a630e370...] role=user type=turn I've been having trouble sleeping lately. Any tips\n", - " [e8f0a465...] [efcc37f1...] role=agent type=turn Keep a consistent sleep schedule, avoid screens 1 \n", - " [e8f0a465...] [bcd60808...] role=user type=turn Does caffeine really affect sleep that much?\n", - " [e8f0a465...] [d1569024...] role=agent type=turn Yes — caffeine has a half-life of about 5-6 hours,\n", - " [e9d75005...] [summary_...] role=system type=summary The user shared personal background information in\n", - " [45853aeb...] [1cf925ed...] role=user type=turn Can you remind me of the Tokyo restaurant suggesti\n", - " [45853aeb...] [2094ee58...] role=agent type=turn Of course! Last time we discussed Ain Soph in Shin\n", - " [e9d75005...] [fact_fb7...] role=system type=fact The user loves hiking in the Pacific Northwest.\n", - " [e9d75005...] [fact_6ee...] role=system type=fact The user usually runs 5 miles every morning before\n", - " [ticket-9...] [ed75dc84...] role=user type=turn Hi, I'm having issues with my Surface Pro 9. The b\n", - " [ticket-9...] [6743a768...] role=agent type=turn I'm sorry to hear that. Could you share when you b\n", - " [ticket-9...] [090753e4...] role=user type=turn I bought it in March 2024 from the Microsoft Store\n", - " [ticket-9...] [5cf00dc0...] role=agent type=turn Thanks. I'll check warranty status. Could you also\n", - " [ticket-9...] [4fba41de...] role=user type=turn It's alex.chen@example.com. The order number was M\n", - " [ticket-9...] [3aec4d8c...] role=agent type=turn Verified — the device is under warranty. I've init\n", - " [ticket-9...] [3f14a39f...] role=user type=turn OK, will do. By the way, I work as a software engi\n", - " [e8f0a465...] [summary_...] role=system type=summary The user asked for help with recent sleep difficul\n", - " [75d8811b...] [fact_74b...] role=system type=fact The user is planning a trip to Tokyo next month.\n", - " [75d8811b...] [fact_858...] role=system type=fact The user follows a vegetarian diet.\n", - " [e8f0a465...] [fact_e49...] role=system type=fact The user has been having trouble sleeping lately.\n", - " [75d8811b...] [summary_...] role=system type=summary The user discussed plans for a trip to Tokyo next \n", - " [__user_s...] [user_sum...] role=system type=user_summary The user is planning a trip to Tokyo next month (m\n", - " [ticket-9...] [summary_...] role=system type=summary The user reported that their Surface Pro 9 battery\n", - " [ticket-9...] [fact_5d4...] role=system type=fact The user owns a Surface Pro 9 with a battery that \n", - " [ticket-9...] [fact_d40...] role=system type=fact The user purchased the Surface Pro 9 in March 2024\n", - " [ticket-9...] [fact_dfd...] role=system type=fact The user's email address is alex.chen@example.com.\n", - " [ticket-9...] [fact_d88...] role=system type=fact The order number for the Surface Pro 9 purchase is\n", - " [ticket-9...] [fact_b5d...] role=system type=fact The user's Surface Pro 9 is currently under warran\n", - " [ticket-9...] [fact_d3e...] role=system type=fact The user works as a software engineer and relies o\n", - " [ticket-9...] [fact_b88...] role=system type=fact The user agreed to run the Surface app diagnostic \n", - " [ticket-9...] [fact_772...] role=system type=fact The contact email associated with the Surface Pro \n", - " [ticket-9...] [fact_4e4...] role=system type=fact The user owns a Surface Pro 9 that currently exper\n", - " [ticket-9...] [fact_ac3...] role=system type=fact The order number for the user's Surface Pro 9 purc\n", - " [ticket-f...] [e1f26087...] role=user type=turn Hello again — Alex from the previous battery ticke\n", - " [ticket-f...] [5d5a3234...] role=agent type=turn Welcome back, Alex! Yes, that confirms the diagnos\n", - " [ticket-f...] [65e5092f...] role=user type=turn Great. While we're talking, can you recommend a US\n", - " [ticket-f...] [e2aff8e0...] role=agent type=turn The Surface Dock 2 or the Anker 778 are excellent \n", - " [ticket-f...] [28bd61e6...] role=user type=turn Multi-monitor is exactly what I need — I run 3 dis\n", - " [ticket-f...] [summary_...] role=system type=summary Alex reported a degraded battery on a Surface Pro \n", - " [ticket-f...] [fact_165...] role=system type=fact The Surface app diagnostic reported that the user'\n", - " [ticket-f...] [fact_9cf...] role=system type=fact A replacement battery service unit will be shipped\n", - " [ticket-f...] [fact_343...] role=system type=fact The user requires a USB-C dock compatible with the\n", - " [__user_s...] [user_sum...] role=system type=user_summary The user's name is Alex Chen.; The user's email ad\n", - " [ticket-f...] [fact_d81...] role=system type=fact The Surface app diagnostic reports that the user's\n", - " [ticket-f...] [fact_6ba...] role=system type=fact The user needs a USB-C dock compatible with the Su\n", - " [ticket-f...] [fact_8af...] role=system type=fact The user runs three displays for development work.\n", - " [ticket-f...] [ep_802fc...] role=system type=episodic The user's Surface Pro 9 was experiencing rapid ba\n", - " [ticket-b...] [4fea4556...] role=user type=turn Hi, I have a quick question about my Microsoft 365\n", - " [ticket-b...] [c8451dd2...] role=agent type=turn Welcome back, Alex! Happy to help with your Micros\n", - " [84350066...] [fbf439c3...] role=user type=turn Compare the environmental impact of electric vehic\n", - " [84350066...] [cc6e41cf...] role=agent type=turn PLAN:\n", - " 1. Research manufacturing impact (battery \n", - " [84350066...] [c8a01395...] role=agent type=turn FINDING 1 — Manufacturing: EV battery production e\n", - " [84350066...] [9a5c4e1d...] role=agent type=turn FINDING 2 — Energy source: EVs charged on renewabl\n", - " [84350066...] [6b1206fd...] role=agent type=turn FINDING 3 — End-of-life: Li-ion battery recycling \n", - " [84350066...] [25903ff0...] role=agent type=turn RECOMMENDATION: For urban fleets, battery-electric\n", - " [thread-e...] [666e8ef8...] role=system type=fact User prefers Python over Java for backend work\n", - " [thread-e...] [dcecaffb...] role=system type=fact User is allergic to peanuts\n", - " [thread-e...] [e26acf75...] role=system type=fact User lives in Seattle, WA\n", - " [thread-e...] [7f5e185b...] role=system type=episodic Last Friday the user shipped a Cosmos-backed searc\n", - " [thread-e...] [0bee2a1f...] role=system type=episodic User attended PyCon 2024 in Pittsburgh\n", - " [thread-e...] [fb81b994...] role=system type=procedural When the user says 'deploy', run `azd up` and tail\n", - " [thread-e...] [ad19e9c8...] role=system type=procedural Always confirm before purging Cosmos containers\n", - " [84350066...] [summary_...] role=system type=summary The conversation analyzed the environmental impact\n", - " [4c99b9ba...] [c1dffbb4...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [4c99b9ba...] [d1d42c19...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [4c99b9ba...] [6587d05b...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [4c99b9ba...] [477bfcf3...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [4c99b9ba...] [f133d14c...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [73810c6b...] [6a262048...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [73810c6b...] [4a24bc5a...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [73810c6b...] [752b35cc...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [73810c6b...] [6037ae5b...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [73810c6b...] [fact_8c6...] role=system type=fact The user loves Italian food.\n", - " [73810c6b...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [4c99b9ba...] [summary_...] role=system type=summary The user inquired about the weather in Seattle for\n", - " [2b2d0c38...] [995608e2...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [2b2d0c38...] [c9765c5e...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [2b2d0c38...] [00e02473...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [2b2d0c38...] [summary_...] role=system type=summary The user sent three consecutive test messages aski\n", - " [34249f73...] [eb3f86b6...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [34249f73...] [81d468be...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [34249f73...] [d9fd8db5...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [34249f73...] [c00391d0...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [34249f73...] [71a3704f...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [eb1efd30...] [29e6e76e...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [eb1efd30...] [d943c1a2...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [eb1efd30...] [a7cb61d7...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [eb1efd30...] [fbf6a5a9...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [eb1efd30...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [34249f73...] [summary_...] role=system type=summary The user inquired about the weather in Seattle for\n", - " [3283e3ce...] [ep_e85c2...] role=system type=episodic The user was planning a weekend trip to Seattle an\n", - " [a55e80a2...] [91c849c4...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [a55e80a2...] [1c317519...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [a55e80a2...] [e8aef776...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [a55e80a2...] [summary_...] role=system type=summary The user sent three consecutive messages requestin\n", - " [ae1eb483...] [3241461e...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [ae1eb483...] [a2d755ba...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ae1eb483...] [3fee9eaa...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [ae1eb483...] [1eabf113...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [ae1eb483...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [3283e3ce...] [ep_3c6fb...] role=system type=episodic The user planned a weekend trip to Seattle and req\n", - " [da6adb20...] [fact_e99...] role=system type=fact The user took a trip to Japan during cherry blosso\n", - " [__proced...] [proc_d2c...] role=system type=procedural When discussing deployment, always check the resou\n", - " [05c82d43...] [summary_...] role=system type=summary The conversation was about the user’s interest in \n", - " [05c82d43...] [fact_5b6...] role=system type=fact The user loves Italian cooking, especially pasta.\n", - " [05c82d43...] [fact_9bf...] role=system type=fact The user makes homemade fettuccine every weekend.\n", - " [f34d2765...] [summary_...] role=system type=summary The conversation was about the user’s daily runnin\n", - " [f34d2765...] [fact_cee...] role=system type=fact The user runs approximately 5 kilometres each day.\n", - " [151e417e...] [667d1b16...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [151e417e...] [00f1ec4f...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [151e417e...] [a49ad927...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [151e417e...] [a5a39119...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [151e417e...] [374d57e5...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [75b607c1...] [f2156f30...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [75b607c1...] [18d7b346...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [75b607c1...] [f5ec5d91...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [75b607c1...] [22c624a7...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [75b607c1...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [151e417e...] [summary_...] role=system type=summary The user inquired about the weather in Seattle for\n", - " [b09413cf...] [ff54043b...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [b09413cf...] [b97e629e...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [b09413cf...] [d99569a7...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [b09413cf...] [summary_...] role=system type=summary The user submitted three consecutive test messages\n", - " [18ec5623...] [48c350cb...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [18ec5623...] [20ddefe7...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [18ec5623...] [17a3e670...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [18ec5623...] [963a36a6...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [18ec5623...] [d53dad25...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [6514d03a...] [a6a9534e...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [6514d03a...] [2fbee9d5...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [6514d03a...] [6d1d2965...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [6514d03a...] [08f3076a...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [6514d03a...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [18ec5623...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [8c19d9fd...] [44bd3992...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [8c19d9fd...] [5bf99e0c...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [8c19d9fd...] [72485888...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [8c19d9fd...] [summary_...] role=system type=summary The user posted three consecutive test messages as\n", - " [thread-0...] [2b72e0ee...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [1f6ffd63...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [95ed7676...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [3a203195...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [3f725325...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [a92f4b54...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [9f3e86e1...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [6370552e...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [97b7e174...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [e38ecbee...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [70962375...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [72ddcc06...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-5...] [609929f8...] role=user type=turn I'm planning a hiking trip to Olympic National Par\n", - " [thread-5...] [c3c713fa...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-5...] [39d808cf...] role=user type=turn I'd like to camp 2 nights. Any permit guidance?\n", - " [thread-5...] [c7364e90...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-5...] [f5b81eba...] role=user type=turn Thanks — also, I'm vegetarian, please remember tha\n", - " [thread-3...] [8db09cea...] role=user type=turn I'm planning a hiking trip to Olympic National Par\n", - " [thread-3...] [c527bd97...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-3...] [70722057...] role=user type=turn I'd like to camp 2 nights. Any permit guidance?\n", - " [thread-3...] [7371ee6c...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-3...] [c405fc0b...] role=user type=turn Thanks — also, I'm vegetarian, please remember tha\n", - " [thread-0...] [d0e5e3c0...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [95d62050...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [d5a09f4a...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [be0085d4...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [cc7d040a...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [c09230e7...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-c...] [61bff06f...] role=user type=turn I'm planning a hiking trip to Olympic National Par\n", - " [thread-c...] [3582eb74...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-c...] [8133e553...] role=user type=turn I'd like to camp 2 nights. Any permit guidance?\n", - " [thread-c...] [598dff39...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-c...] [4bb7b2c4...] role=user type=turn Thanks — also, I'm vegetarian, please remember tha\n", - " [thread-c...] [summary_...] role=system type=summary The user discussed planning a hiking and camping t\n", - " [2dec0199...] [492d9dbb...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [2dec0199...] [d53348b1...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [2dec0199...] [048b347d...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [2dec0199...] [f170341e...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [2dec0199...] [f3b2e998...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [97d1c7d2...] [b34510a1...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [97d1c7d2...] [45d6f3eb...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [97d1c7d2...] [d57ed8f9...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [97d1c7d2...] [61ec5e9b...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [2dec0199...] [summary_...] role=system type=summary The user inquired about the weather in Seattle for\n", - " [97d1c7d2...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [437580e8...] [1eefde64...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [437580e8...] [741b0b83...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [437580e8...] [41fcd871...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [437580e8...] [ebb06dba...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [437580e8...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [3283e3ce...] [ep_c489a...] role=system type=episodic The user was planning a weekend trip to Seattle an\n", - " [f6e63541...] [43830249...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [f6e63541...] [9c052937...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [f6e63541...] [8b2c0b88...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [f6e63541...] [summary_...] role=system type=summary The user sent three consecutive test messages requ\n", - " [9ed6e905...] [10da44e8...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [9ed6e905...] [f200bbc0...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [9ed6e905...] [59877c89...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [9ed6e905...] [30b9b34f...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [9ed6e905...] [9a2a651c...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [9ed6e905...] [d7f74720...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [9ed6e905...] [bfb488e8...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [9ed6e905...] [1498a6b1...] role=user type=turn Also, if a round-trip flight ever costs more than \n", - " [9ed6e905...] [0d216b3d...] role=agent type=turn Understood — I'll confirm with you before booking \n", - " [9ed6e905...] [5123cac9...] role=user type=turn One more thing: when picking a hotel, always check\n", - " [9ed6e905...] [c9b3d5ab...] role=agent type=turn Will do. I'll filter hotel suggestions to only tho\n", - " [ede78157...] [6f6aec0d...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [ede78157...] [d89aa694...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ede78157...] [2bd4f216...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [ede78157...] [bda83ce2...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [ede78157...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [9ed6e905...] [summary_...] role=system type=summary The conversation focused on planning a weekend tri\n", - " [__proced...] [proc_931...] role=system type=procedural Always select an aisle seat when booking flights f\n", - " [__proced...] [proc_bb3...] role=system type=procedural If a round-trip flight costs more than $300, stop \n", - " [__proced...] [proc_d15...] role=system type=procedural Always verify that breakfast is included before re\n", - " [c627fc8c...] [3a23f2c1...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [c627fc8c...] [3fb6ea61...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [c627fc8c...] [166d689f...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [c627fc8c...] [summary_...] role=system type=summary The user sent three consecutive messages asking fo\n", - " [e2422aed...] [0cc39f4a...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [e2422aed...] [a5c17037...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [e2422aed...] [d2d28ce4...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [e2422aed...] [bed9110b...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [e2422aed...] [a0ebc75c...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [e2422aed...] [a07d551b...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [e2422aed...] [85416876...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [e2422aed...] [602974a7...] role=user type=turn One more thing: when picking a hotel, always check\n", - " [e2422aed...] [a5595e14...] role=user type=turn Also, if a round-trip flight ever costs more than \n", - " [e2422aed...] [fac38202...] role=agent type=turn Will do. I'll filter hotel suggestions to only tho\n", - " [e2422aed...] [01b514c0...] role=agent type=turn Understood — I'll confirm with you before booking \n", - " [ba2753c5...] [e5242b96...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [ba2753c5...] [f62c3be1...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ba2753c5...] [256f126e...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [ba2753c5...] [5f541c2a...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [ba2753c5...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [e2422aed...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [3283e3ce...] [ep_69c22...] role=system type=episodic The user planned a weekend trip to Seattle and req\n", - " [e761b38f...] [644b1c65...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [e761b38f...] [187cb97b...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [e761b38f...] [1a4868c7...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [e761b38f...] [summary_...] role=system type=summary The user repeatedly requested information about ve\n", - " [d3a73355...] [07408ee7...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [d3a73355...] [7fc1a400...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [d3a73355...] [a895d314...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [d3a73355...] [64d95944...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [d3a73355...] [05901836...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [d3a73355...] [f0588b81...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [d3a73355...] [a762cd26...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [d3a73355...] [fb3b29cb...] role=user type=turn Also, if a round-trip flight ever costs more than \n", - " [d3a73355...] [81ce6316...] role=agent type=turn Understood — I'll confirm with you before booking \n", - " [d3a73355...] [b7132ab4...] role=user type=turn One more thing: when picking a hotel, always check\n", - " [d3a73355...] [86a404c9...] role=agent type=turn Will do. I'll filter hotel suggestions to only tho\n", - " [e9ed3070...] [cd7f6b1e...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [e9ed3070...] [9cf12919...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [e9ed3070...] [fe00ba5d...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [e9ed3070...] [8712d011...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [e9ed3070...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [d3a73355...] [summary_...] role=system type=summary The conversation centered on planning a weekend tr\n", - " [62a3a5c8...] [aa370d97...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [62a3a5c8...] [14ab61c9...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [62a3a5c8...] [26ee5819...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [62a3a5c8...] [summary_...] role=system type=summary The user sent three consecutive messages asking fo\n", - " [92fcfce7...] [8db42544...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [92fcfce7...] [9b497f45...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [92fcfce7...] [2ac1f955...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [92fcfce7...] [9e72adc1...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [92fcfce7...] [340d4e33...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [92fcfce7...] [1eb0d2c3...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [92fcfce7...] [3a3d1544...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [92fcfce7...] [60277430...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [92fcfce7...] [ba8c8d52...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [92fcfce7...] [d9b1592b...] role=user type=turn And never book me into anything that departs or ar\n", - " [92fcfce7...] [2485f06d...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [26392a45...] [793c6f84...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [26392a45...] [41f1ba4d...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [26392a45...] [3fd7590b...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [26392a45...] [54cf4894...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [26392a45...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [__proced...] [proc_62f...] role=system type=procedural When planning a trip for the user, first check the\n", - " [__proced...] [proc_b28...] role=system type=procedural Never book flights that depart or arrive between m\n", - " [92fcfce7...] [summary_...] role=system type=summary The conversation focused on planning a weekend tri\n", - " [3a9921f9...] [7ca8f672...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [3a9921f9...] [b081cfa7...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [3a9921f9...] [b2f71697...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [3a9921f9...] [summary_...] role=system type=summary The user repeatedly asked for information about ve\n", - " [f0fd9a78...] [bc85dd29...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [f0fd9a78...] [7df1661f...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [f0fd9a78...] [1f84e8ac...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [f0fd9a78...] [62abba0b...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [f0fd9a78...] [034bd98c...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [f0fd9a78...] [77ac6f91...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [f0fd9a78...] [9bc141ef...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [f0fd9a78...] [a9d6ffc0...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [f0fd9a78...] [51227197...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [f0fd9a78...] [043fc770...] role=user type=turn And never book me into anything that departs or ar\n", - " [f0fd9a78...] [f6cd2184...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [5c3287a4...] [3e7d7dd6...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [5c3287a4...] [5955e0e9...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [5c3287a4...] [f45c05b0...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [5c3287a4...] [9866371e...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [5c3287a4...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [f0fd9a78...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [2f517f40...] [468248fe...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [2f517f40...] [13be98ec...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [2f517f40...] [46cd74c8...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [2f517f40...] [summary_...] role=system type=summary The user sent three identical test messages asking\n", - " [b48abfd4...] [220e3777...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [b48abfd4...] [04627b70...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [b48abfd4...] [8cd6cac1...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [b48abfd4...] [01c33d7d...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [b48abfd4...] [b022017e...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [b48abfd4...] [6a317eda...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [b48abfd4...] [83a30869...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [b48abfd4...] [f8df8e80...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [b48abfd4...] [1d2f503d...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [b48abfd4...] [d363effd...] role=user type=turn And never book me into anything that departs or ar\n", - " [b48abfd4...] [a087dfa4...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [dbdc90d0...] [1b4a20d8...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [dbdc90d0...] [8aaead6f...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [dbdc90d0...] [83df810c...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [dbdc90d0...] [e2e684e6...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [dbdc90d0...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [b48abfd4...] [summary_...] role=system type=summary The conversation focused on planning a weekend tri\n", - " [8adaad5f...] [614a52a8...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [8adaad5f...] [628b5e82...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [8adaad5f...] [f05774e7...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [8adaad5f...] [summary_...] role=system type=summary The user repeatedly requested information about ve\n", - " [a1210ca7...] [8f8c0453...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [a1210ca7...] [8486acee...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [a1210ca7...] [1329afa7...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [a1210ca7...] [210b1234...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [a1210ca7...] [0712700a...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [a1210ca7...] [33dfad55...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [a1210ca7...] [3a6887c4...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [a1210ca7...] [a9a357fb...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [a1210ca7...] [9c18002a...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [a1210ca7...] [8bc59512...] role=user type=turn And never book me into anything that departs or ar\n", - " [a1210ca7...] [7835ebd2...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [e97abcfc...] [86bbc4ef...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [e97abcfc...] [c40acde3...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [e97abcfc...] [bcab2b5c...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [e97abcfc...] [25890ac3...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [e97abcfc...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [a1210ca7...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [a1210ca7...] [fact_ccc...] role=system type=fact The user requires round-trip flights to cost under\n", - " [__proced...] [proc_408...] role=system type=procedural Always select an aisle seat when booking flights f\n", - " [__proced...] [proc_6da...] role=system type=procedural Follow this order for trip planning: first check t\n", - " [__proced...] [proc_778...] role=system type=procedural Never book flights that depart or arrive between m\n", - " [__user_s...] [user_sum...] role=system type=user_summary For the planned Seattle weekend trip, the user set\n", - " [a1210ca7...] [fact_e7b...] role=system type=fact The user prefers to stay near Pike Place Market wh\n", - " [__proced...] [proc_056...] role=system type=procedural Always book an aisle seat when reserving flights f\n", - " [__proced...] [proc_074...] role=system type=procedural Follow the trip planning order: first check the we\n", - " [__proced...] [proc_b50...] role=system type=procedural Never book travel that departs or arrives between \n", - " [ee162c4e...] [15dd4113...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [ee162c4e...] [b6abc60f...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [ee162c4e...] [70dd5fba...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [a1210ca7...] [fact_44d...] role=system type=fact The user requires hotel stays to cost under $200 p\n", - " [ee162c4e...] [summary_...] role=system type=summary The user repeatedly asked for information about ve\n", - " [8f82e8c2...] [5431ec91...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [8f82e8c2...] [86395b5c...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [8f82e8c2...] [f810ee90...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [8f82e8c2...] [adf43f71...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [8f82e8c2...] [2c53284f...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [8f82e8c2...] [824b7d06...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [8f82e8c2...] [03f4f090...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [8f82e8c2...] [4e39a623...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [8f82e8c2...] [e61823c0...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [8f82e8c2...] [011604c6...] role=user type=turn And never book me into anything that departs or ar\n", - " [8f82e8c2...] [de44f072...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [925c1a31...] [dd1a62f4...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [925c1a31...] [1bc3a721...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [925c1a31...] [d334b9f8...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [925c1a31...] [81c4308b...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [925c1a31...] [03e66bf9...] role=user type=turn Never book me into anything that departs or arrive\n", - " [925c1a31...] [bbbce8be...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [925c1a31...] [6ad6dcd7...] role=user type=turn When picking a hotel, only recommend ones that inc\n", - " [925c1a31...] [490aeb85...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [1aba6dfb...] [94d40c8a...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [1aba6dfb...] [67c9d6d2...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [1aba6dfb...] [d808c78f...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [1aba6dfb...] [f973d01f...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [925c1a31...] [summary_...] role=system type=summary The user established standing travel preferences a\n", - " [__proced...] [proc_433...] role=system type=procedural Always book an aisle seat and never select a windo\n", - " [__proced...] [proc_938...] role=system type=procedural For trip planning, first check the weather for the\n", - " [__proced...] [proc_ada...] role=system type=procedural Never book travel that departs or arrives between \n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [__proced...] [proc_3c1...] role=system type=procedural Always book an aisle seat and never select a windo\n", - " [__proced...] [proc_2bf...] role=system type=procedural First check the weather, then check flights, and b\n", - " [8f82e8c2...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [1aba6dfb...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [__proced...] [proc_4ac...] role=system type=procedural Only recommend hotels that include complimentary b\n", - " [8f82e8c2...] [fact_1fd...] role=system type=fact For the Seattle weekend trip, the user requires ro\n", - " [8f82e8c2...] [fact_b62...] role=system type=fact For the Seattle weekend trip, the user requires ho\n", - " [8f82e8c2...] [fact_555...] role=system type=fact For the Seattle weekend trip, the user prefers hot\n", - " [8f82e8c2...] [fact_5b6...] role=system type=fact No flight or hotel reservations were finalized for\n", - " [4c829316...] [d5b082ea...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [4c829316...] [1a0a7275...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [4c829316...] [85d26801...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [4c829316...] [summary_...] role=system type=summary The user sent three consecutive test messages aski\n", - " [df2c66e2...] [a95f36c7...] role=user type=turn And never book me into anything that departs or ar\n", - " [df2c66e2...] [885e20a1...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [df2c66e2...] [86f7ffdf...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [df2c66e2...] [a14e680c...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [df2c66e2...] [291b33d2...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [df2c66e2...] [8ac8ad2d...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [df2c66e2...] [c506e7b2...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [df2c66e2...] [0085b70d...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [ae1bb147...] [044f536b...] role=user type=turn Never book me into anything that departs or arrive\n", - " [ae1bb147...] [49f590c9...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [ae1bb147...] [3863b2a1...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [ae1bb147...] [e5a7e19f...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [ae1bb147...] [36fc3840...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [df2c66e2...] [d2b63415...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [df2c66e2...] [293d9579...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [ae1bb147...] [6d68214d...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [ae1bb147...] [88479523...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [df2c66e2...] [44f1c083...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [ae1bb147...] [fffe6fde...] role=user type=turn When picking a hotel, only recommend ones that inc\n", - " [85e74267...] [7cfd003e...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [85e74267...] [32b3911a...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [85e74267...] [046fc368...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [85e74267...] [2594fb41...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [85e74267...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [__proced...] [proc_b00...] role=system type=procedural Always book an aisle seat and never select a windo\n", - " [ae1bb147...] [summary_...] role=system type=summary The user established standing travel booking prefe\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [__proced...] [proc_4b0...] role=system type=procedural First check the weather, then check flights, and b\n", - " [__proced...] [proc_53a...] role=system type=procedural Never book travel that departs or arrives between \n", - " [__proced...] [proc_eef...] role=system type=procedural Only recommend hotels that include complimentary b\n", - " [df2c66e2...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [df2c66e2...] [fact_f5d...] role=system type=fact For the Seattle trip, the user requires round-trip\n", - " [df2c66e2...] [fact_a7d...] role=system type=fact For the Seattle trip, the user requires hotel rate\n", - " [df2c66e2...] [fact_53c...] role=system type=fact For the Seattle trip, the user prefers hotels loca\n", - " [__proced...] [proc_ef1...] role=system type=procedural Always book an aisle seat when reserving flights f\n", - " [__proced...] [proc_286...] role=system type=procedural When planning a trip, first check the weather for \n", - " [__proced...] [proc_9a3...] role=system type=procedural Never book flights that depart or arrive between m\n", - " [1a2686a2...] [72643b0a...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [1a2686a2...] [653a328a...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [1a2686a2...] [0ce72055...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [1a2686a2...] [36f4abfe...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [1a2686a2...] [62e4971c...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [1a2686a2...] [c91a8397...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [1a2686a2...] [b0f0f031...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [1a2686a2...] [de786284...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [1a2686a2...] [863a0e92...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [1a2686a2...] [440b3ccd...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [1a2686a2...] [6c71c103...] role=user type=turn And never book me into anything that departs or ar\n", - " [6c5e0b18...] [9d94e048...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [6c5e0b18...] [a9ca1c0c...] role=user type=turn Never book me into anything that departs or arrive\n", - " [6c5e0b18...] [b8d706b5...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [6c5e0b18...] [8079f2a5...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [6c5e0b18...] [6ec3f38c...] role=user type=turn When picking a hotel, only recommend ones that inc\n", - " [6c5e0b18...] [b3cac85c...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [6c5e0b18...] [bce69f91...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [6c5e0b18...] [096d24da...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [ac8cf2db...] [3b3f7880...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [ac8cf2db...] [e388f6c6...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ac8cf2db...] [47cf2489...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [ac8cf2db...] [ad4aa222...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [ac8cf2db...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [__proced...] [proc_372...] role=system type=procedural Always book an aisle seat and never select a windo\n", - " [__proced...] [proc_5c8...] role=system type=procedural Follow this order for trip planning: first check t\n", - " [__proced...] [proc_9f3...] role=system type=procedural Never book flights that depart or arrive between m\n", - " [__proced...] [proc_eb7...] role=system type=procedural Only recommend hotels that include complimentary b\n", - " [6c5e0b18...] [summary_...] role=system type=summary The user established persistent travel booking pre\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [1a2686a2...] [fact_f0a...] role=system type=fact The user prefers hotels located near Pike Place Ma\n", - " [1a2686a2...] [fact_67a...] role=system type=fact The user requires round-trip flights to cost under\n", - " [1a2686a2...] [summary_...] role=system type=summary The conversation focused on planning a weekend tri\n", - " [1a2686a2...] [fact_92f...] role=system type=fact The user requires hotels to cost under $200 per ni\n", - " [__proced...] [proc_d23...] role=system type=procedural Always book an aisle seat when reserving flights f\n", - " [__proced...] [proc_210...] role=system type=procedural For trip planning, first check the destination wea\n", - " [__proced...] [proc_afd...] role=system type=procedural Never book travel that departs or arrives between \n", - " [30387fc9...] [d0e2a4c7...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [30387fc9...] [e81a71eb...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [30387fc9...] [3b386db9...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [30387fc9...] [summary_...] role=system type=summary The user repeatedly asked for information about ve\n", - " [0df5b6dc...] [f79fbed6...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [0df5b6dc...] [26681a8e...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [0df5b6dc...] [87fa4b2f...] role=user type=turn Can you book me a weekend trip there? Flights unde\n", - " [0df5b6dc...] [864f087a...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [0df5b6dc...] [7f1c2807...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [0df5b6dc...] [0cdaa994...] role=agent type=turn Got it — aisle seats only.\n", - " [0df5b6dc...] [6595962f...] role=user type=turn For trip planning, my workflow is: first weather, \n", - " [0df5b6dc...] [4f35ab5b...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [0df5b6dc...] [872bf1fb...] role=user type=turn Never book me into anything between midnight and 6\n", - " [0df5b6dc...] [ab9e45ba...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [0df5b6dc...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [bc4a98cb...] [16bb8e00...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [bc4a98cb...] [1076e63c...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [bc4a98cb...] [740137c4...] role=user type=turn Can you book me a weekend trip there? Flights unde\n", - " [bc4a98cb...] [6ba1d437...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [bc4a98cb...] [c97de899...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [bc4a98cb...] [fcf81c7c...] role=agent type=turn Got it — aisle seats only.\n", - " [bc4a98cb...] [059c3307...] role=user type=turn For trip planning, my workflow is: first weather, \n", - " [bc4a98cb...] [45e487f4...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [bc4a98cb...] [0a31dba0...] role=user type=turn Never book me into anything between midnight and 6\n", - " [bc4a98cb...] [1c81ae44...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [0df5b6dc...] [fact_f54...] role=system type=fact The user requires flights to cost under $300 when \n", - " [0df5b6dc...] [fact_cd2...] role=system type=fact The user requires hotels to cost under $200 per ni\n", - " [__proced...] [proc_de5...] role=system type=procedural Always book an aisle seat and never select a windo\n", - " [__proced...] [proc_7d7...] role=system type=procedural Follow the sequence weather → flights → hotel when\n", - " [__proced...] [proc_4d7...] role=system type=procedural Never book flights or accommodations scheduled bet\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [bc4a98cb...] [summary_...] role=system type=summary The user inquired about the weather in Seattle for\n", - " [bc4a98cb...] [fact_008...] role=system type=fact The user prefers aisle seats and does not want win\n", - " [__proced...] [proc_4b6...] role=system type=procedural Always book an aisle seat and never select a windo\n", - " [__proced...] [proc_781...] role=system type=procedural Follow the trip planning sequence: first check wea\n", - " [bc4a98cb...] [fact_84c...] role=system type=fact The user requires flights to cost under $300 and h\n", - " [__proced...] [proc_861...] role=system type=procedural Always book an aisle seat when booking flights for\n", - " [__proced...] [proc_fc7...] role=system type=procedural Follow the sequence weather → flights → hotel when\n", - " [__proced...] [proc_f86...] role=system type=procedural Never book any flights, hotels, or other travel ar\n", - " [bc4a98cb...] [fact_ef8...] role=system type=fact The user requires flights to cost under $300 when \n", - " [bc4a98cb...] [fact_48a...] role=system type=fact The user requires hotels to cost under $200 per ni\n", - " [__proced...] [proc_7a9...] role=system type=procedural Always book an aisle seat when reserving flights f\n", - " [__proced...] [proc_f7a...] role=system type=procedural Never book any travel or reservations between midn\n", - " [bdd72079...] [c35421d5...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [bdd72079...] [9a99982d...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [bdd72079...] [23949c83...] role=user type=turn Can you book me a weekend trip there? Flights unde\n", - " [bdd72079...] [f17db44a...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [bdd72079...] [037bdee7...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [bdd72079...] [804c1f25...] role=agent type=turn Got it — aisle seats only.\n", - " [bdd72079...] [c8b3bc80...] role=user type=turn For trip planning, my workflow is: first weather, \n", - " [bdd72079...] [56d4e04b...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [bdd72079...] [3ba30ca4...] role=user type=turn Never book me into anything between midnight and 6\n", - " [bdd72079...] [9857a10d...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [bdd72079...] [summary_...] role=system type=summary The conversation centered on planning a potential \n", - " [bdd72079...] [fact_18e...] role=system type=fact The user requires flights under $300 and hotels un\n", - " [__proced...] [proc_352...] role=system type=procedural Always book an aisle seat when reserving flights f\n", - " [__proced...] [proc_df7...] role=system type=procedural Follow the sequence: check weather first, then boo\n", - " [__proced...] [proc_a79...] role=system type=procedural Never book flights, hotels, or other travel arrang\n", - " [42b91b2c...] [18d9c7c9...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [42b91b2c...] [aee54464...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [42b91b2c...] [eb65d898...] role=user type=turn Can you book me a weekend trip there? Flights unde\n", - " [42b91b2c...] [2610f0f2...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [42b91b2c...] [a2c8f719...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [42b91b2c...] [81e4ae3f...] role=agent type=turn Got it — aisle seats only.\n", - " [42b91b2c...] [d8bb773e...] role=user type=turn For trip planning, my workflow is: first weather, \n", - " [42b91b2c...] [88c29041...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [42b91b2c...] [e72a7a00...] role=user type=turn Never book me into anything between midnight and 6\n", - " [42b91b2c...] [aec0a2ba...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [42b91b2c...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [42b91b2c...] [fact_95d...] role=system type=fact The user requested booking a weekend trip to Seatt\n", - " [42b91b2c...] [fact_81e...] role=system type=fact The user requires flights to cost under $300 and h\n", - " [__proced...] [proc_d89...] role=system type=procedural Always book an aisle seat and never book a window \n", - " [__proced...] [proc_5ed...] role=system type=procedural Follow the sequence weather first, then flights, t\n", - " [__proced...] [proc_afb...] role=system type=procedural Never book flights or accommodations between midni\n", - " [e50f775e...] [3e4513c7...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [e50f775e...] [88a718fa...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [e50f775e...] [5d25077d...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [e50f775e...] [79dae6a8...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [e50f775e...] [4f8721a6...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [e50f775e...] [fb17aeea...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [e50f775e...] [3f00a18c...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [e50f775e...] [a8485c36...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [e50f775e...] [4d4926ec...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [e50f775e...] [4e597b6d...] role=user type=turn And never book me into anything that departs or ar\n", - " [e50f775e...] [96aa9017...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [8f42e1b5...] [d060a91b...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [8f42e1b5...] [26ba3a10...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [8f42e1b5...] [4efc2fe2...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [8f42e1b5...] [2430022a...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [8f42e1b5...] [61a8ac71...] role=user type=turn Never book me into anything that departs or arrive\n", - " [8f42e1b5...] [300757b0...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [8f42e1b5...] [1fe93ba3...] role=user type=turn When picking a hotel, only recommend ones that inc\n", - " [8f42e1b5...] [c997e440...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [7b8fc78b...] [0ad9d278...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [7b8fc78b...] [0e5d8a0a...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [7b8fc78b...] [ec1a3a5d...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [7b8fc78b...] [c0437ffe...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [8f42e1b5...] [summary_...] role=system type=summary The user established persistent travel booking pre\n", - " [7b8fc78b...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [__proced...] [proc_afe...] role=system type=procedural Always book an aisle seat and never select a windo\n", - " [__proced...] [proc_c12...] role=system type=procedural Follow this order for trip planning: first check t\n", - " [__proced...] [proc_c6f...] role=system type=procedural Never book travel that departs or arrives between \n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [__proced...] [proc_9d5...] role=system type=procedural Only recommend hotels that include complimentary b\n", - " [e50f775e...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [e50f775e...] [fact_9e9...] role=system type=fact The user prefers hotels located near Pike Place Ma\n", - " [e50f775e...] [fact_2ad...] role=system type=fact The user requires round-trip flights to cost under\n", - " [e50f775e...] [fact_230...] role=system type=fact The user requires hotel rates to be under $200 per\n", - " [__proced...] [proc_dee...] role=system type=procedural Always book an aisle seat when reserving flights f\n", - " [807c3bc6...] [c6b6827e...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [807c3bc6...] [101560c2...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [807c3bc6...] [558654f4...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [c1138077...] [47eef782...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [c1138077...] [30da082b...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [c1138077...] [40665284...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [c1138077...] [c5d66e1a...] role=user type=turn Never book me into anything that departs or arrive\n", - " [807c3bc6...] [5544d374...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [807c3bc6...] [3ee542c4...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [807c3bc6...] [67cee94e...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [807c3bc6...] [afe25494...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [c1138077...] [2b7e104d...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [807c3bc6...] [bb55ae9b...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [c1138077...] [4e5b3a7d...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [c1138077...] [15f9f705...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [807c3bc6...] [97401d13...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [807c3bc6...] [3a42a459...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [807c3bc6...] [056e8fcb...] role=user type=turn And never book me into anything that departs or ar\n", - " [c1138077...] [705626cf...] role=user type=turn When picking a hotel, only recommend ones that inc\n", - " [6b59bbaf...] [cc399b5f...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [6b59bbaf...] [6a66be86...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [6b59bbaf...] [287c7246...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [6b59bbaf...] [546aff6a...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [6b59bbaf...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [c1138077...] [summary_...] role=system type=summary The user established specific standing preferences\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [__proced...] [proc_2f7...] role=system type=procedural Always book an aisle seat when reserving flights f\n", - " [__proced...] [proc_e3f...] role=system type=procedural For trip planning, first check the weather, then c\n", - " [__proced...] [proc_79b...] role=system type=procedural Never book travel that departs or arrives between \n", - " [__proced...] [proc_34e...] role=system type=procedural Only recommend hotels that include complimentary b\n", - " [807c3bc6...] [summary_...] role=system type=summary The conversation centered on planning a weekend tr\n", - " [807c3bc6...] [fact_db1...] role=system type=fact The user prefers round-trip flights under $300.\n", - " [807c3bc6...] [fact_afc...] role=system type=fact The user prefers hotels under $200 per night.\n", - " [__proced...] [proc_88e...] role=system type=procedural Always book an aisle seat and never select a windo\n", - " [__proced...] [proc_183...] role=system type=procedural Follow this trip planning order: first check the w\n", - " [__proced...] [proc_aff...] role=system type=procedural Never book flights that depart or arrive between m\n", - " [807c3bc6...] [fact_023...] role=system type=fact The user prefers hotels located near Pike Place Ma\n", - " [e14d2b93...] [a54fd759...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [e14d2b93...] [34f80709...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [e14d2b93...] [8a47c8f7...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [e14d2b93...] [131015e6...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [e14d2b93...] [f01ae2bb...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [e14d2b93...] [fd18c1e3...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [e14d2b93...] [b47560e8...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [e14d2b93...] [a1c02435...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [e14d2b93...] [fe6666fd...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [e14d2b93...] [f17b3408...] role=user type=turn And never book me into anything that departs or ar\n", - " [e14d2b93...] [4be20fc0...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [49f67589...] [5a6bffdb...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [49f67589...] [f5f9a65f...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [49f67589...] [5c70dee0...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [49f67589...] [5d2f37b4...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [49f67589...] [4ad08e53...] role=user type=turn Never book me into anything that departs or arrive\n", - " [49f67589...] [1bd931bb...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [49f67589...] [87019f1f...] role=user type=turn When picking a hotel, only recommend ones that inc\n", - " [49f67589...] [cb598c87...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [bb7ca0ed...] [8f712520...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [bb7ca0ed...] [dfea17c8...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [bb7ca0ed...] [573b3124...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [bb7ca0ed...] [81c3abc7...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n" - ] - } - ], - "source": [ - "# Delete the tool memory from Cosmos\n", - "tool_mems = memory.get_memories(user_id=\"user-002\", role=\"tool\")\n", - "print(tool_mems[0])\n", - "if tool_mems:\n", - " memory.delete_cosmos(\n", - " tool_mems[0][\"id\"],\n", - " thread_id=tool_mems[0][\"thread_id\"],\n", - " user_id=tool_mems[0][\"user_id\"],\n", - " )\n", - " print(f\"Deleted tool memory {tool_mems[0]['id'][:8]}...\")\n", - "\n", - "# Verify\n", - "remaining = memory.get_memories()\n", - "print(f\"\\nRemaining memories in Cosmos DB: {len(remaining)}\")\n", - "for r in remaining:\n", - " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} type={r['type']:<8} {r['content'][:50]}\")" - ] - }, - { - "cell_type": "markdown", - "id": "d177810a", - "metadata": {}, - "source": [ - "### 3e. Retrieve a full thread with `get_thread`\n", - "\n", - "`get_thread` fetches all memories for a given `thread_id` from Cosmos DB, returned in chronological order (oldest first).\n", - "\n", - "- **`thread_id`** (required) – the thread to retrieve\n", - "- **`user_id`** (optional) – filter to a specific user\n", - "- **`recent_k`** (optional) – return only the *k* most recent documents; omit to get all" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "d27e2c80", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:50:56.348243Z", - "start_time": "2026-05-04T19:50:56.027458Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:50.411141Z", - "iopub.status.busy": "2026-05-04T20:26:50.411056Z", - "iopub.status.idle": "2026-05-04T20:26:50.605647Z", - "shell.execute_reply": "2026-05-04T20:26:50.605066Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Using thread_id: e14d2b93-dbdc-46e7-99db-d3c916198047\n", - "\n", - "All memories in thread: 11\n", - " [e14d2b93...] [a54fd759...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [e14d2b93...] [34f80709...] role=agent type=turn This weekend Seattle will be around 55°F with partly cloudy \n", - " [e14d2b93...] [8a47c8f7...] role=agent type=turn Sure! I found round-trip flights departing Friday evening an\n", - " [e14d2b93...] [131015e6...] role=user type=turn Something near Pike Place Market would be great. Keep flight\n", - " [e14d2b93...] [f01ae2bb...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 and two hot\n", - " [e14d2b93...] [fd18c1e3...] role=user type=turn Whenever you book a flight for me, always book an aisle seat\n", - " [e14d2b93...] [b47560e8...] role=agent type=turn Got it. I'll always select an aisle seat for your bookings.\n", - " [e14d2b93...] [a1c02435...] role=user type=turn For trip planning, my workflow is: first check the weather f\n", - " [e14d2b93...] [fe6666fd...] role=agent type=turn Noted — I'll follow that order: weather, then flights, then \n", - " [e14d2b93...] [f17b3408...] role=user type=turn And never book me into anything that departs or arrives betw\n", - " [e14d2b93...] [4be20fc0...] role=agent type=turn Will do — no overnight bookings without your explicit approv\n", - "\n", - "Most recent 2 memories:\n", - " [e14d2b93...] [f17b3408...] role=user type=turn And never book me into anything that departs or arrives betw\n", - " [e14d2b93...] [4be20fc0...] role=agent type=turn Will do — no overnight bookings without your explicit approv\n", - "\n", - "Thread memories for user-001: 11\n" - ] - } - ], - "source": [ - "# Use the CURRENT seed thread (from cell 5) so we operate on the data we just wrote.\n", - "thread_id = THREAD_ID\n", - "print(f\"Using thread_id: {thread_id}\\n\")\n", - "\n", - "# Get all documents in the thread\n", - "thread_all = memory.get_thread(thread_id=thread_id)\n", - "print(f\"All memories in thread: {len(thread_all)}\")\n", - "for m in thread_all:\n", - " print(f\" [{m['thread_id'][:8]}...] [{m['id'][:8]}...] role={m.get('role','?'):6} type={m['type']:8} {m['content'][:60]}\")\n", - "\n", - "# Most recent 2\n", - "recent = memory.get_thread(thread_id=thread_id, recent_k=2)\n", - "print(f\"\\nMost recent 2 memories:\")\n", - "for m in recent:\n", - " print(f\" [{m['thread_id'][:8]}...] [{m['id'][:8]}...] role={m.get('role','?'):6} type={m['type']:8} {m['content'][:60]}\")\n", - "\n", - "# Filter to a specific user\n", - "thread_user = memory.get_thread(thread_id=thread_id, user_id=USER_ID)\n", - "print(f\"\\nThread memories for user-001: {len(thread_user)}\")\n" - ] - }, - { - "cell_type": "markdown", - "id": "adfa2a66", - "metadata": {}, - "source": [ - "## 4. Thread Summary (in-process)\n", - "\n", - "`generate_thread_summary()` runs the summarisation pipeline **in-process** — no Azure Functions\n", - "required. It will:\n", - "\n", - "1. Query Cosmos DB for memories matching the given `user_id` + `thread_id`.\n", - "2. Optionally keep only the **k most recent** documents (`recent_k`).\n", - "3. Call the configured AI Foundry LLM to produce a structured summary.\n", - "4. Generate a vector embedding of the summary.\n", - "5. Upsert the result back into Cosmos DB as a memory of type `\"summary\"`.\n", - "\n", - "If a prior summary exists, the call performs an **incremental update** that preserves the\n", - "metadata-tracked `source_count`.\n" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "ccbf3c6762ca4ffc", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:50:58.760327Z", - "start_time": "2026-05-04T19:50:58.625811Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:50.607649Z", - "iopub.status.busy": "2026-05-04T20:26:50.607529Z", - "iopub.status.idle": "2026-05-04T20:27:01.949372Z", - "shell.execute_reply": "2026-05-04T20:27:01.948569Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Summarizing thread_id=e14d2b93-dbdc-46e7-99db-d3c916198047 user_id=user-09577899\n", - "\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "LLM model=gpt-5.2-chat rejected 'temperature'; retrying without it.\n" - ] - } - ], - "source": [ - "# Use the CURRENT seed thread (from cell 5) so summarisation operates on the new data.\n", - "thread_id = THREAD_ID\n", - "user_id = USER_ID\n", - "print(f\"Summarizing thread_id={thread_id} user_id={user_id}\\n\")\n", - "\n", - "# Run the thread summary pipeline (in-process). Returns the persisted summary doc.\n", - "summary_doc = memory.generate_thread_summary(user_id=user_id, thread_id=thread_id)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "d5f360c618f237ca", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:51:01.923467Z", - "start_time": "2026-05-04T19:51:01.886475Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:27:01.951750Z", - "iopub.status.busy": "2026-05-04T20:27:01.951586Z", - "iopub.status.idle": "2026-05-04T20:27:01.954872Z", - "shell.execute_reply": "2026-05-04T20:27:01.954192Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Summary document:\n", - " id: summary_user-09577899_e14d2b93-dbdc-46e7-99db-d3c916198047\n", - " content: The conversation focused on planning a weekend trip to Seattle, including checking the weather, identifying flights and hotels near Pike Place Market within a specified budget, and establishing the us...\n", - " source_count: 11\n", - " embedding length: 1536\n" - ] - } - ], - "source": [ - "print(\"Summary document:\")\n", - "print(f\" id: {summary_doc['id']}\")\n", - "print(f\" content: {summary_doc['content'][:200]}...\")\n", - "print(f\" source_count: {summary_doc.get('metadata', {}).get('source_count')}\")\n", - "print(f\" embedding length: {len(summary_doc.get('embedding', []))}\")\n" - ] - }, - { - "cell_type": "markdown", - "id": "3b932f35", - "metadata": {}, - "source": [ - "## 5. Memory Extraction (facts + episodic + procedural)\n", - "\n", - "`extract_memories()` runs a single LLM call that produces three structured memory types:\n", - "\n", - "| Type | Description |\n", - "|-------------|--------------------------------------------------------------------------|\n", - "| `fact` | Stable, atomic facts about the user. |\n", - "| `episodic` | Discrete past events (\"Last spring, the user hiked Mount Rainier.\"). |\n", - "| `procedural`| How-to guidance the agent should follow (\"When debugging the LLM, ...\").|\n", - "\n", - "Each derived memory is embedded and stored in Cosmos DB with auto-generated tags and a\n", - "salience score. The call returns a count summary.\n" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "ae73f87c", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:51:19.112267Z", - "start_time": "2026-05-04T19:51:04.510037Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:27:01.956444Z", - "iopub.status.busy": "2026-05-04T20:27:01.956348Z", - "iopub.status.idle": "2026-05-04T20:27:08.337601Z", - "shell.execute_reply": "2026-05-04T20:27:08.336433Z" - } - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "LLM model=gpt-5.2-chat rejected 'temperature'; retrying without it.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Seed thread extraction: {'facts_count': 0, 'procedural_count': 0, 'episodic_count': 0, 'updated_count': 0}\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "LLM model=gpt-5.2-chat rejected 'temperature'; retrying without it.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Rules thread extraction: {'facts_count': 0, 'procedural_count': 0, 'episodic_count': 0, 'updated_count': 0}\n" - ] - } - ], - "source": [ - "# Extract memories from the SEED thread (mixed factual + booking specifics).\n", - "result_main = memory.extract_memories(user_id=USER_ID, thread_id=THREAD_ID)\n", - "print(\"Seed thread extraction:\", result_main)\n", - "\n", - "# Extract from the pure-procedural RULES thread to surface procedural memories.\n", - "result_rules = memory.extract_memories(user_id=USER_ID, thread_id=RULES_THREAD_ID)\n", - "print(\"Rules thread extraction:\", result_rules)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "4cbe2ff4", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:51:22.391047Z", - "start_time": "2026-05-04T19:51:22.282774Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:27:08.340224Z", - "iopub.status.busy": "2026-05-04T20:27:08.340031Z", - "iopub.status.idle": "2026-05-04T20:27:08.473245Z", - "shell.execute_reply": "2026-05-04T20:27:08.472613Z" - } - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "FACTS (3):\n", - " • The user prefers hotels located near Pike Place Market in Seattle. [salience=0.7]\n", - " • The user requires round-trip flights to cost under $300. [salience=0.9]\n", - " • The user requires hotel stays to cost under $200 per night. [salience=0.9]\n", - "\n", - "EPISODICS (0):\n", - "\n", - "PROCEDURALS (9):\n", - " • Always book an aisle seat when booking flights for the user; never select a window or middle seat. [salience=0.9]\n", - " • Follow this order for trip planning: first check the weather, then check flights, and book the hotel [salience=0.85]\n", - " • Never book travel that departs or arrives between midnight and 6am unless the user explicitly approv [salience=0.9]\n", - " • Only recommend hotels that include complimentary breakfast. [salience=0.85]\n", - " • Always book an aisle seat and never select a window or middle seat when booking flights for the user [salience=0.85]\n", - " • Follow this order for trip planning: first check the weather for the destination, then check flights [salience=0.8]\n", - " • Never book flights that depart or arrive between midnight and 6am unless the user explicitly approve [salience=0.9]\n", - " • Always select an aisle seat when booking flights for the user; never choose a window or middle seat. [salience=0.9]\n", - " • Follow this trip planning order: first check the destination weather, then check flights, and book t [salience=0.85]\n" - ] - } - ], - "source": [ - "# Inspect the persisted derived memories across BOTH threads for this user.\n", - "for mt in (\"fact\", \"episodic\", \"procedural\"):\n", - " docs = memory.get_memories(user_id=USER_ID, memory_types=[mt])\n", - " print(f\"\\n{mt.upper()}S ({len(docs)}):\")\n", - " for d in docs:\n", - " print(f\" • {d['content'][:100]} [salience={d.get('salience')}]\")\n" - ] - }, - { - "cell_type": "markdown", - "id": "4f9db816", - "metadata": {}, - "source": [ - "## 6. User Summary (cross-thread profile)\n", - "\n", - "`generate_user_summary()` aggregates memories **across all threads** for a user and produces\n", - "a structured profile (preferences, account state, behavioural patterns, …). The result is\n", - "stored in Cosmos DB with `type: \"user_summary\"`.\n", - "\n", - "- **`user_id`** (required) – the user to build the profile for\n", - "- **`thread_ids`** (optional) – limit to specific threads; omit for all threads\n", - "- **`recent_k`** (optional) – per-thread recency limit\n", - "\n", - "Retrieve the latest stored profile at any time with `get_user_summary(user_id)` — useful\n", - "for priming new conversations.\n" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "e248f5f8", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:51:40.206458Z", - "start_time": "2026-05-04T19:51:32.902642Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:27:08.474717Z", - "iopub.status.busy": "2026-05-04T20:27:08.474603Z", - "iopub.status.idle": "2026-05-04T20:27:17.174075Z", - "shell.execute_reply": "2026-05-04T20:27:17.173319Z" - } - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "LLM model=gpt-5.2-chat rejected 'temperature'; retrying without it.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "User summary id: user_summary_user-09577899\n", - "\n", - "Content:\n", - " {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \"The user requires aisle seats for all flight bookings and explicitly does not want window or middle seats.\",\n", - " \"The user does not want flights that depart or arrive between midnight and 6am unless they explicitly approve it.\",\n", - " \"The user prefers hotels that include complimentary breakfast and only wants such hotels recommended.\",\n", - " \"The user prefers travel planning to follow a specific order: check the weather first, then check flights, and book the hotel last after everything else is confirmed.\",\n", - " \"The user sets explicit budget c ...\n", - "\n", - "Structured profile keys: ['key_facts', 'personal_preferences', 'account_environment', 'goals_current_work', 'behavioral_patterns', 'compliance_requirements', 'open_items', 'topics']\n" - ] - } - ], - "source": [ - "# Generate a user-level summary across all threads for user_id.\n", - "user_summary_doc = memory.generate_user_summary(user_id=user_id)\n", - "print(\"User summary id:\", user_summary_doc[\"id\"])\n", - "print(\"\\nContent:\\n\", user_summary_doc[\"content\"][:600], \"...\")\n", - "print(\"\\nStructured profile keys:\", list(user_summary_doc.get(\"metadata\", {}).get(\"structured_summary\", {}).keys()))\n" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "6a6483c8", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:51:44.920125Z", - "start_time": "2026-05-04T19:51:44.831055Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:27:17.176169Z", - "iopub.status.busy": "2026-05-04T20:27:17.176040Z", - "iopub.status.idle": "2026-05-04T20:27:17.240128Z", - "shell.execute_reply": "2026-05-04T20:27:17.239204Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "User Summary for user-09577899\n", - "{\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \"The user requires aisle seats for all flight bookings and explicitly does not want window or middle seats.\",\n", - " \"The user does not want flights that depart or arrive between midnight and 6am unless they explicitly approve it.\",\n", - " \"The user prefers hotels that include complimentary breakfast and only wants such hotels recommended.\",\n", - " \"The user prefers travel planning to follow a specific order: check the weather first, then check flights, and book the hotel last after everything else is confirmed.\",\n", - " \"The user sets explicit budget constraints for travel (e.g., under $300 round trip for flights and under $200 per night for hotels in one example).\"\n", - " ],\n", - " \"account_environment\": [],\n", - " \"goals_current_work\": [\n", - " \"The user is planning trips that involve booking flights and hotels with defined constraints and preferences.\",\n", - " \"The user is planning a weekend trip to Seattle, seeking flights under $300 round trip and hotels under $200 per night within walking distance of Pike Place Market.\"\n", - " ],\n", - " \"behavioral_patterns\": [\n", - " \"The user repeats their travel booking rules across multiple threads, indicating these are standing preferences.\",\n", - " \"The user provides clear constraints (budget, location, amenities) before confirming bookings.\",\n", - " \"The user follows a structured and process-driven approach to trip planning.\"\n", - " ],\n", - " \"compliance_requirements\": [],\n", - " \"open_items\": [\n", - " \"The user has not yet selected a specific flight or confirmed a hotel booking for the planned Seattle weekend trip.\"\n", - " ],\n", - " \"topics\": [\n", - " \"travel\",\n", - " \"flight booking\",\n", - " \"hotel booking\",\n", - " \"trip planning\",\n", - " \"budget travel\",\n", - " \"travel preferences\",\n", - " \"Seattle travel\"\n", - " ]\n", - "}\n" - ] - } - ], - "source": [ - "# Retrieve the stored user summary from Cosmos DB\n", - "stored = memory.get_user_summary(user_id=user_id)\n", - "if stored:\n", - " print(\"User Summary for\", user_id)\n", - " print(stored[\"content\"])\n", - "else:\n", - " print(\"No user summary found — run the generate_user_summary cell first.\")\n" - ] - }, - { - "cell_type": "markdown", - "id": "f34532d8", - "metadata": {}, - "source": [ - "### 7. Vector search with `search_cosmos`\n", - "\n", - "`search_cosmos` embeds a natural-language query via your AI Foundry model and runs a `VectorDistance` similarity search in Cosmos DB. Optionally filter by `user_id` or `thread_id`.\n" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "id": "8cad9e1c", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:51:48.450405Z", - "start_time": "2026-05-04T19:51:47.803095Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:27:17.242064Z", - "iopub.status.busy": "2026-05-04T20:27:17.241948Z", - "iopub.status.idle": "2026-05-04T20:27:17.723314Z", - "shell.execute_reply": "2026-05-04T20:27:17.722345Z" - } - }, - "outputs": [], - "source": [ - "results = memory.search_cosmos(\n", - " search_terms=\"What did the user ask about the weather?\",\n", - " user_id=USER_ID,\n", - " top_k=3,\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "id": "73ea6150", - "metadata": { - "ExecuteTime": { - "end_time": "2026-05-04T19:51:49.865957Z", - "start_time": "2026-05-04T19:51:49.841121Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:27:17.725695Z", - "iopub.status.busy": "2026-05-04T20:27:17.725537Z", - "iopub.status.idle": "2026-05-04T20:27:17.728740Z", - "shell.execute_reply": "2026-05-04T20:27:17.728106Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Top 3 results:\n", - "\n", - " [summary_...] score=N/A The conversation focused on planning a weekend trip to Seatt\n", - " [user_sum...] score=N/A {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \"The us\n", - " [proc_6ec...] score=N/A Follow this trip planning order: first check the destination\n" - ] - } - ], - "source": [ - "print(f\"Top {len(results)} results:\\n\")\n", - "for r in results:\n", - " score = r.get(\"score\", \"N/A\")\n", - " print(f\" [{r['id'][:8]}...] score={score} {r['content'][:60]}\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1d2185169357621f", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "py314", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.15" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/Samples/Demo_async.ipynb b/Samples/Demo_async.ipynb deleted file mode 100644 index a3c1d21..0000000 --- a/Samples/Demo_async.ipynb +++ /dev/null @@ -1,2900 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "04a283f1", - "metadata": {}, - "source": [ - "## 1. Setup\n", - "\n", - "Install/import dependencies and load environment variables from `.env`." - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "id": "15434fb9", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:06:39.082693Z", - "start_time": "2026-04-07T22:06:38.712684Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:25:45.211452Z", - "iopub.status.busy": "2026-05-04T20:25:45.211356Z", - "iopub.status.idle": "2026-05-04T20:25:45.346501Z", - "shell.execute_reply": "2026-05-04T20:25:45.346098Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "COSMOS_DB_ENDPOINT: https://akataria-agent-memory-testing.documents.azure.com:443/\n", - "COSMOS_DB_DATABASE: ai_memory\n", - "COSMOS_DB_CONTAINER: memories\n", - "COSMOS_DB_COUNTERS_CONTAINER: counter\n", - "COSMOS_DB_LEASE_CONTAINER: leases\n", - "COSMOS_DB_THROUGHPUT_MODE: serverless\n", - "COSMOS_DB_AUTOSCALE_MAX_RU: 1000\n" - ] - } - ], - "source": [ - "import os, json, sys\n", - "\n", - "from pathlib import Path\n", - "\n", - "sys.path.insert(0, os.path.abspath(\"..\"))\n", - "\n", - "\n", - "\n", - "from dotenv import load_dotenv\n", - "\n", - "from agent_memory_toolkit.aio import AsyncCosmosMemoryClient\n", - "\n", - "\n", - "\n", - "# Load environment variables from .env in the repo root\n", - "\n", - "load_dotenv(os.path.join(\"..\", \".env\"))\n", - "\n", - "\n", - "\n", - "print(\"COSMOS_DB_ENDPOINT:\", os.getenv(\"COSMOS_DB_ENDPOINT\"))\n", - "\n", - "print(\"COSMOS_DB_DATABASE:\", os.getenv(\"COSMOS_DB_DATABASE\"))\n", - "\n", - "print(\"COSMOS_DB_CONTAINER:\", os.getenv(\"COSMOS_DB_CONTAINER\"))\n", - "\n", - "print(\"COSMOS_DB_COUNTERS_CONTAINER:\", os.getenv(\"COSMOS_DB_COUNTERS_CONTAINER\", \"counter\"))\n", - "\n", - "print(\"COSMOS_DB_LEASE_CONTAINER:\", os.getenv(\"COSMOS_DB_LEASE_CONTAINER\", \"leases\"))\n", - "\n", - "print(\"COSMOS_DB_THROUGHPUT_MODE:\", os.getenv(\"COSMOS_DB_THROUGHPUT_MODE\", \"serverless\"))\n", - "\n", - "print(\"COSMOS_DB_AUTOSCALE_MAX_RU:\", os.getenv(\"COSMOS_DB_AUTOSCALE_MAX_RU\", \"1000\"))" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "75bf151787e8aaa2", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:06:41.229355Z", - "start_time": "2026-04-07T22:06:41.014359Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:25:45.347628Z", - "iopub.status.busy": "2026-05-04T20:25:45.347566Z", - "iopub.status.idle": "2026-05-04T20:25:45.652841Z", - "shell.execute_reply": "2026-05-04T20:25:45.652467Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "AsyncCosmosMemoryClient instance created\n", - "Throughput mode: serverless\n", - "Local memory store: []\n" - ] - } - ], - "source": [ - "from azure.identity.aio import DefaultAzureCredential as AsyncDefaultAzureCredential\n", - "\n", - "# Credential priority: explicit cosmos_credential > explicit cosmos_key > DefaultAzureCredential.\n", - "# Set COSMOS_DB_KEY in your .env if you don't yet have control-plane RBAC (currently in private preview).\n", - "memory = AsyncCosmosMemoryClient(\n", - " cosmos_endpoint=os.getenv(\"COSMOS_DB_ENDPOINT\"),\n", - " cosmos_database=os.getenv(\"COSMOS_DB_DATABASE\"),\n", - " cosmos_container=os.getenv(\"COSMOS_DB_CONTAINER\"),\n", - " cosmos_counter_container=os.getenv(\"COSMOS_DB_COUNTERS_CONTAINER\", \"counter\"),\n", - " cosmos_lease_container=os.getenv(\"COSMOS_DB_LEASE_CONTAINER\", \"leases\"),\n", - " cosmos_throughput_mode=os.getenv(\"COSMOS_DB_THROUGHPUT_MODE\", \"serverless\"),\n", - " cosmos_autoscale_max_ru=int(os.getenv(\"COSMOS_DB_AUTOSCALE_MAX_RU\", \"1000\")),\n", - " cosmos_key=os.getenv(\"COSMOS_DB_KEY\"),\n", - " ai_foundry_endpoint=os.getenv(\"AI_FOUNDRY_ENDPOINT\"),\n", - " ai_foundry_api_key=os.getenv(\"AI_FOUNDRY_API_KEY\"),\n", - " embedding_deployment_name=os.getenv(\"AI_FOUNDRY_EMBEDDING_DEPLOYMENT_NAME\", \"text-embedding-3-large\"),\n", - " chat_deployment_name=os.getenv(\"AI_FOUNDRY_CHAT_DEPLOYMENT_NAME\", \"gpt-4o-mini\"),\n", - " use_default_credential=True,\n", - ")\n", - "\n", - "print(\"AsyncCosmosMemoryClient instance created\")\n", - "print(\"Throughput mode:\", os.getenv(\"COSMOS_DB_THROUGHPUT_MODE\", \"serverless\"))\n", - "print(\"Local memory store:\", memory.local_memory)\n" - ] - }, - { - "cell_type": "markdown", - "id": "3ed9ad79", - "metadata": {}, - "source": [ - "## 2. Local Memory Operations\n", - "\n", - "`AsyncCosmosMemoryClient` mirrors the sync API. Local operations (`add_local`, `get_local`, `update_local`, `delete_local`) are synchronous under the hood (in-memory list), but the class is designed for use in async code paths.\n", - "\n", - "> **Note:** In Jupyter you can `await` directly in cells without wrapping in `asyncio.run()`." - ] - }, - { - "cell_type": "markdown", - "id": "56eadc55", - "metadata": {}, - "source": [ - "### 2a. Add memories with `add_local`" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "5619b2ed", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:06:45.409758Z", - "start_time": "2026-04-07T22:06:45.149684Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:25:45.653810Z", - "iopub.status.busy": "2026-05-04T20:25:45.653720Z", - "iopub.status.idle": "2026-05-04T20:25:45.655764Z", - "shell.execute_reply": "2026-05-04T20:25:45.655372Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "User ID: user-ea5eba7a\n", - "Thread ID: 807c3bc6-c021-4f66-b996-07bc5ef781ab\n", - "\n" - ] - } - ], - "source": [ - "import uuid\n", - "THREAD_ID = str(uuid.uuid4())\n", - "# Use a unique user_id per demo run so we get a clean extraction without\n", - "# inheriting facts from prior runs that would dedup new content away.\n", - "USER_ID = f\"user-{uuid.uuid4().hex[:8]}\"\n", - "print(f\"User ID: {USER_ID}\")\n", - "print(f\"Thread ID: {THREAD_ID}\\n\")\n" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "5ce1b88c", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:06:47.709471Z", - "start_time": "2026-04-07T22:06:47.682021Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:25:45.656663Z", - "iopub.status.busy": "2026-05-04T20:25:45.656610Z", - "iopub.status.idle": "2026-05-04T20:25:45.660512Z", - "shell.execute_reply": "2026-05-04T20:25:45.660236Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Added 12 memories\n", - "[\n", - " {\n", - " \"id\": \"558654f4-87cd-49c9-ad8c-efb35081a7ff\",\n", - " \"user_id\": \"user-ea5eba7a\",\n", - " \"thread_id\": \"807c3bc6-c021-4f66-b996-07bc5ef781ab\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"What's the weather like in Seattle this weekend?\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:25:45.658915+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"c6b6827e-4768-475c-87a5-adad9cb2b2d0\",\n", - " \"user_id\": \"user-ea5eba7a\",\n", - " \"thread_id\": \"807c3bc6-c021-4f66-b996-07bc5ef781ab\",\n", - " \"role\": \"agent\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"This weekend Seattle will be around 55\\u00b0F with partly cloudy skies on Saturday and light rain expected Sunday.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:25:45.658939+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"afa8d19a-293c-4104-9262-fa4f63f9bc6a\",\n", - " \"user_id\": \"user-ea5eba7a\",\n", - " \"thread_id\": \"807c3bc6-c021-4f66-b996-07bc5ef781ab\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"That sounds nice enough. Can you help me book a trip to Seattle for this weekend?\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:25:45.658953+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"101560c2-fd8f-4ad0-b323-510503bd472a\",\n", - " \"user_id\": \"user-ea5eba7a\",\n", - " \"thread_id\": \"807c3bc6-c021-4f66-b996-07bc5ef781ab\",\n", - " \"role\": \"agent\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Sure! I found round-trip flights departing Friday evening and returning Sunday night. There are also several hotels in downtown Seattle with availability. Would you like me to look at specific airlines or neighborhoods?\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:25:45.658966+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"afe25494-52f6-4370-a5a2-c8d09fea8fd3\",\n", - " \"user_id\": \"user-ea5eba7a\",\n", - " \"thread_id\": \"807c3bc6-c021-4f66-b996-07bc5ef781ab\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Something near Pike Place Market would be great. And keep the flights under $300 round trip if possible.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:25:45.658978+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"67cee94e-1b2f-4456-882f-40ae84925e30\",\n", - " \"user_id\": \"user-ea5eba7a\",\n", - " \"thread_id\": \"807c3bc6-c021-4f66-b996-07bc5ef781ab\",\n", - " \"role\": \"agent\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"I found a round-trip on Alaska Airlines for $275 and two hotel options within a 5-minute walk of Pike Place Market: the Inn at the Market ($189/night) and a Hilton Garden Inn ($145/night). Want me to reserve one of these?\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:25:45.658991+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"bb55ae9b-d50c-4d82-b03a-458c599c5d5c\",\n", - " \"user_id\": \"user-ea5eba7a\",\n", - " \"thread_id\": \"807c3bc6-c021-4f66-b996-07bc5ef781ab\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Whenever you book a flight for me, always book an aisle seat \\u2014 never a window or middle.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:25:45.659003+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"3ee542c4-6717-4e85-a2b3-6170f8600e11\",\n", - " \"user_id\": \"user-ea5eba7a\",\n", - " \"thread_id\": \"807c3bc6-c021-4f66-b996-07bc5ef781ab\",\n", - " \"role\": \"agent\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Got it. I'll always select an aisle seat for your bookings.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:25:45.659015+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"5544d374-0b6f-437c-a6a7-b6522e9f8604\",\n", - " \"user_id\": \"user-ea5eba7a\",\n", - " \"thread_id\": \"807c3bc6-c021-4f66-b996-07bc5ef781ab\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"For trip planning, my workflow is: first check the weather for the destination, then check flights, then book the hotel last after everything else is confirmed.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:25:45.659028+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"3a42a459-1e0a-4923-a63b-b899230f5003\",\n", - " \"user_id\": \"user-ea5eba7a\",\n", - " \"thread_id\": \"807c3bc6-c021-4f66-b996-07bc5ef781ab\",\n", - " \"role\": \"agent\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Noted \\u2014 I'll follow that order: weather, then flights, then hotel.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:25:45.659039+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"056e8fcb-514a-495f-8e30-affcf9e2b56e\",\n", - " \"user_id\": \"user-ea5eba7a\",\n", - " \"thread_id\": \"807c3bc6-c021-4f66-b996-07bc5ef781ab\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"And never book me into anything that departs or arrives between midnight and 6am unless I explicitly approve it.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:25:45.659051+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " },\n", - " {\n", - " \"id\": \"97401d13-7f8c-46bb-8dc5-1d0ea3d9d299\",\n", - " \"user_id\": \"user-ea5eba7a\",\n", - " \"thread_id\": \"807c3bc6-c021-4f66-b996-07bc5ef781ab\",\n", - " \"role\": \"agent\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Will do \\u2014 no overnight bookings without your explicit approval.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:25:45.659062+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - " }\n", - "]\n", - "Rules thread ID: c1138077-4c41-49a1-8758-5d7cdcef4347 (8 turns)\n" - ] - } - ], - "source": [ - "# Add sample conversation: weather in Seattle → booking a trip (6 turns)\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", - " content=\"What's the weather like in Seattle this weekend?\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", - " content=\"This weekend Seattle will be around 55°F with partly cloudy skies on Saturday and light rain expected Sunday.\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", - " content=\"That sounds nice enough. Can you help me book a trip to Seattle for this weekend?\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", - " content=\"Sure! I found round-trip flights departing Friday evening and returning Sunday night. There are also several hotels in downtown Seattle with availability. Would you like me to look at specific airlines or neighborhoods?\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", - " content=\"Something near Pike Place Market would be great. And keep the flights under $300 round trip if possible.\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", - " content=\"I found a round-trip on Alaska Airlines for $275 and two hotel options within a 5-minute walk of Pike Place Market: the Inn at the Market ($189/night) and a Hilton Garden Inn ($145/night). Want me to reserve one of these?\",\n", - ")\n", - "\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", - " content=\"Whenever you book a flight for me, always book an aisle seat — never a window or middle.\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", - " content=\"Got it. I'll always select an aisle seat for your bookings.\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", - " content=\"For trip planning, my workflow is: first check the weather for the destination, then check flights, then book the hotel last after everything else is confirmed.\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", - " content=\"Noted — I'll follow that order: weather, then flights, then hotel.\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", - " content=\"And never book me into anything that departs or arrives between midnight and 6am unless I explicitly approve it.\",\n", - ")\n", - "memory.add_local(\n", - " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", - " content=\"Will do — no overnight bookings without your explicit approval.\",\n", - ")\n", - "\n", - "print(f\"Added {len(memory.local_memory)} memories\")\n", - "print(json.dumps(memory.get_local(), indent=2))\n", - "\n", - "# A second short thread of pure procedural-style instructions. Demonstrates\n", - "# that the extractor produces clean procedural items when the conversation is\n", - "# focused on rules/workflows rather than mixed with factual booking specifics.\n", - "RULES_THREAD_ID = str(uuid.uuid4())\n", - "for role, content in [\n", - " (\"user\", \"Whenever you book a flight for me, always book an aisle seat — never a window or middle.\"),\n", - " (\"agent\", \"Got it. I'll always select an aisle seat for your bookings.\"),\n", - " (\"user\", \"For trip planning, my workflow is: first check the weather, then check flights, and book the hotel last after everything else is confirmed.\"),\n", - " (\"agent\", \"Noted — I'll follow that order: weather, then flights, then hotel.\"),\n", - " (\"user\", \"Never book me into anything that departs or arrives between midnight and 6am unless I explicitly approve it.\"),\n", - " (\"agent\", \"Will do — no overnight bookings without your explicit approval.\"),\n", - " (\"user\", \"When picking a hotel, only recommend ones that include complimentary breakfast.\"),\n", - " (\"agent\", \"Understood — only hotels with complimentary breakfast.\"),\n", - "]:\n", - " memory.add_local(user_id=USER_ID, role=role, thread_id=RULES_THREAD_ID, content=content)\n", - "\n", - "print(f\"Rules thread ID: {RULES_THREAD_ID} ({sum(1 for m in memory.local_memory if m['thread_id']==RULES_THREAD_ID)} turns)\")\n" - ] - }, - { - "cell_type": "markdown", - "id": "9a0aac22", - "metadata": {}, - "source": [ - "### 2b. Query memories with `get_local`" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "942e3714", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:06:50.682868Z", - "start_time": "2026-04-07T22:06:50.661470Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:25:45.661416Z", - "iopub.status.busy": "2026-05-04T20:25:45.661371Z", - "iopub.status.idle": "2026-05-04T20:25:45.663639Z", - "shell.execute_reply": "2026-05-04T20:25:45.663296Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Total memories: 20\n", - "\n", - "Memories for user-001: 20\n", - "Tool memories: 10\n", - " [c6b6827e...] This weekend Seattle will be around 55°F with partly cloudy \n", - " [101560c2...] Sure! I found round-trip flights departing Friday evening an\n", - " [67cee94e...] I found a round-trip on Alaska Airlines for $275 and two hot\n", - " [3ee542c4...] Got it. I'll always select an aisle seat for your bookings.\n", - " [3a42a459...] Noted — I'll follow that order: weather, then flights, then \n", - " [97401d13...] Will do — no overnight bookings without your explicit approv\n", - " [40665284...] Got it. I'll always select an aisle seat for your bookings.\n", - " [2b7e104d...] Noted — I'll follow that order: weather, then flights, then \n", - " [30da082b...] Will do — no overnight bookings without your explicit approv\n", - " [4e5b3a7d...] Understood — only hotels with complimentary breakfast.\n", - "\n", - "Fact memories: 0\n", - "\n", - "Agent memories for user-001: 10\n" - ] - } - ], - "source": [ - "# Get all memories\n", - "all_memories = memory.get_local()\n", - "print(f\"Total memories: {len(all_memories)}\\n\")\n", - "\n", - "# Filter by user_id\n", - "user1_memories = memory.get_local(user_id=USER_ID)\n", - "print(f\"Memories for user-001: {len(user1_memories)}\")\n", - "\n", - "# Filter by role\n", - "tool_memories = memory.get_local(role=\"agent\")\n", - "print(f\"Tool memories: {len(tool_memories)}\")\n", - "for m in tool_memories:\n", - " print(f\" [{m['id'][:8]}...] {m['content'][:60]}\")\n", - "\n", - "# Filter by type\n", - "facts = memory.get_local(memory_types=[\"fact\"])\n", - "print(f\"\\nFact memories: {len(facts)}\")\n", - "for m in facts:\n", - " print(f\" [{m['id'][:8]}...] {m['content']}\")\n", - "\n", - "# Combine filters: user-001 + agent role\n", - "user1_agent = memory.get_local(user_id=USER_ID, role=\"agent\")\n", - "print(f\"\\nAgent memories for user-001: {len(user1_agent)}\")" - ] - }, - { - "cell_type": "markdown", - "id": "ba973a1c", - "metadata": {}, - "source": [ - "### 2c. Update & Delete with `update_local` / `delete_local`" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "4ca36086", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:06:53.605394Z", - "start_time": "2026-04-07T22:06:53.576655Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:25:45.664504Z", - "iopub.status.busy": "2026-05-04T20:25:45.664457Z", - "iopub.status.idle": "2026-05-04T20:25:45.666846Z", - "shell.execute_reply": "2026-05-04T20:25:45.666497Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Before update:\n", - "{\n", - " \"id\": \"afe25494-52f6-4370-a5a2-c8d09fea8fd3\",\n", - " \"user_id\": \"user-ea5eba7a\",\n", - " \"thread_id\": \"807c3bc6-c021-4f66-b996-07bc5ef781ab\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Something near Pike Place Market would be great. And keep the flights under $300 round trip if possible.\",\n", - " \"metadata\": {},\n", - " \"created_at\": \"2026-05-04T20:25:45.658978+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000\n", - "}\n", - "\n", - "After update:\n", - "{\n", - " \"id\": \"afe25494-52f6-4370-a5a2-c8d09fea8fd3\",\n", - " \"user_id\": \"user-ea5eba7a\",\n", - " \"thread_id\": \"807c3bc6-c021-4f66-b996-07bc5ef781ab\",\n", - " \"role\": \"user\",\n", - " \"type\": \"turn\",\n", - " \"content\": \"Something near Pike Place Market would be great. Keep flights under $300 round trip and hotels under $200/night.\",\n", - " \"metadata\": {\n", - " \"edited\": true,\n", - " \"reason\": \"user clarified hotel budget\"\n", - " },\n", - " \"created_at\": \"2026-05-04T20:25:45.658978+00:00\",\n", - " \"tags\": [],\n", - " \"ttl\": 2592000,\n", - " \"updated_at\": \"2026-05-04T20:25:45.665382+00:00\"\n", - "}\n", - "\n", - "Deleting memory afa8d19a...\n", - "\n", - "Remaining memories: 19\n", - " [807c3bc6...] [558654f4...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [807c3bc6...] [c6b6827e...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [807c3bc6...] [101560c2...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [807c3bc6...] [afe25494...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [807c3bc6...] [67cee94e...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [807c3bc6...] [bb55ae9b...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [807c3bc6...] [3ee542c4...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [807c3bc6...] [5544d374...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [807c3bc6...] [3a42a459...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [807c3bc6...] [056e8fcb...] role=user type=turn And never book me into anything that departs or ar\n", - " [807c3bc6...] [97401d13...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [c1138077...] [47eef782...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [c1138077...] [40665284...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [c1138077...] [15f9f705...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [c1138077...] [2b7e104d...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [c1138077...] [c5d66e1a...] role=user type=turn Never book me into anything that departs or arrive\n", - " [c1138077...] [30da082b...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [c1138077...] [705626cf...] role=user type=turn When picking a hotel, only recommend ones that inc\n", - " [c1138077...] [4e5b3a7d...] role=agent type=turn Understood — only hotels with complimentary breakf\n" - ] - } - ], - "source": [ - "# Update the user's budget constraint to be more specific\n", - "target_id = memory.local_memory[4][\"id\"] # \"Something near Pike Place Market...\"\n", - "print(f\"Before update:\\n{json.dumps(memory.get_local(memory_id=target_id)[0], indent=2)}\\n\")\n", - "\n", - "memory.update_local(\n", - " memory_id=target_id,\n", - " content=\"Something near Pike Place Market would be great. Keep flights under $300 round trip and hotels under $200/night.\",\n", - " metadata={\"edited\": True, \"reason\": \"user clarified hotel budget\"},\n", - ")\n", - "print(f\"After update:\\n{json.dumps(memory.get_local(memory_id=target_id)[0], indent=2)}\")\n", - "\n", - "# Delete the third memory (index 2 — the user's booking request)\n", - "del_target_id = memory.local_memory[2][\"id\"]\n", - "print(f\"\\nDeleting memory {del_target_id[:8]}...\")\n", - "memory.delete_local(del_target_id)\n", - "\n", - "# Verify it's gone\n", - "print(f\"\\nRemaining memories: {len(memory.get_local())}\")\n", - "for m in memory.get_local():\n", - " print(f\" [{m['thread_id'][:8]}...] [{m['id'][:8]}...] role={m['role']:<6} type={m['type']:<8} {m['content'][:50]}\")" - ] - }, - { - "cell_type": "markdown", - "id": "bad8c2b6", - "metadata": {}, - "source": [ - "## 3. Cosmos DB Operations\n", - "\n", - "### 3a. Connect and create the memory store\n", - "\n", - "The async client auto-connects on the first Cosmos DB operation. Call `create_memory_store()` to create the database and container if they do not already exist, including the hierarchical partition key, vector index, and full-text index.\n", - "\n", - "> **Note:** `create_memory_store()` is safe to run more than once." - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "82b363d7", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:06:58.478498Z", - "start_time": "2026-04-07T22:06:57.474753Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:25:45.667704Z", - "iopub.status.busy": "2026-05-04T20:25:45.667661Z", - "iopub.status.idle": "2026-05-04T20:25:46.372667Z", - "shell.execute_reply": "2026-05-04T20:25:46.371834Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Connected: True\n" - ] - } - ], - "source": [ - "# The async client auto-creates the database and container on the first Cosmos operation.\n", - "# You can also call create_memory_store() explicitly if needed.\n", - "await memory.create_memory_store()\n", - "print(f\"Connected: {memory._container_client is not None}\")" - ] - }, - { - "cell_type": "markdown", - "id": "5c18edf3", - "metadata": {}, - "source": [ - "### 3b. Add memories to Cosmos DB with `add_cosmos`" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "b7d0939d", - "metadata": { - "execution": { - "iopub.execute_input": "2026-05-04T20:25:46.375244Z", - "iopub.status.busy": "2026-05-04T20:25:46.375091Z", - "iopub.status.idle": "2026-05-04T20:25:46.627003Z", - "shell.execute_reply": "2026-05-04T20:25:46.626193Z" - } - }, - "outputs": [], - "source": [ - "await memory.connect_cosmos()" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "e0b3b5fc", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:07:08.081103Z", - "start_time": "2026-04-07T22:07:07.860764Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:25:46.629264Z", - "iopub.status.busy": "2026-05-04T20:25:46.629134Z", - "iopub.status.idle": "2026-05-04T20:25:47.111769Z", - "shell.execute_reply": "2026-05-04T20:25:47.111092Z" - } - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Unclosed client session\n", - "client_session: \n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Unclosed connector\n", - "connections: ['deque([(, 1790853.065794291)])', 'deque([(, 1790853.212369458), (, 1790853.254742)])', 'deque([(, 1790853.517245166)])']\n", - "connector: \n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "New Thread ID: 6b59bbaf-a9ba-4122-a67b-f18ce950ec2d\n", - "\n", - "Local memory count (should be unchanged): 19\n", - "\n", - "Memories in Cosmos DB for new thread: 4\n", - " [6b59bbaf...] [cc399b5f...] role=user Can you recommend some good restaurants in New York City?\n", - " [6b59bbaf...] [17c87803...] role=tool {\"query\": \"top restaurants NYC\", \"results\": [\"Carbone\", \"Nob\n", - " [6b59bbaf...] [6a66be86...] role=agent Absolutely! NYC has incredible dining options. For Italian, \n", - " [6b59bbaf...] [287c7246...] role=user I love Italian food. Are there any options that are budget-f\n" - ] - } - ], - "source": [ - "await memory.push_to_cosmos()\n", - "\n", - "# Push a new thread directly to Cosmos DB without adding to local memory first\n", - "new_thread_id = str(uuid.uuid4())\n", - "print(f\"New Thread ID: {new_thread_id}\\n\")\n", - "\n", - "# Add memories directly to Cosmos DB using add_cosmos\n", - "await memory.add_cosmos(\n", - " user_id=\"user-002\", role=\"user\", thread_id=new_thread_id,\n", - " content=\"Can you recommend some good restaurants in New York City?\",\n", - ")\n", - "await memory.add_cosmos(\n", - " user_id=\"user-002\", role=\"tool\", thread_id=new_thread_id,\n", - " content='{\"query\": \"top restaurants NYC\", \"results\": [\"Carbone\", \"Nobu\", \"Katz\\'s Deli\", \"Le Bernardin\"]}',\n", - " metadata={\"tool_name\": \"restaurant_search\", \"tool_call_id\": \"call_abc123\"},\n", - ")\n", - "await memory.add_cosmos(\n", - " user_id=\"user-002\", role=\"agent\", thread_id=new_thread_id,\n", - " content=\"Absolutely! NYC has incredible dining options. For Italian, try Carbone in Greenwich Village. For sushi, Nobu in Tribeca is world-class. For a classic NYC experience, Katz's Delicatessen on the Lower East Side is a must.\",\n", - ")\n", - "await memory.add_cosmos(\n", - " user_id=\"user-002\", role=\"user\", thread_id=new_thread_id,\n", - " content=\"I love Italian food. Are there any options that are budget-friendly?\",\n", - ")\n", - "await memory.add_cosmos(\n", - " user_id=\"user-002\", role=\"agent\", thread_id=new_thread_id,\n", - " content=\"For budget-friendly Italian in NYC, check out L'industrie Pizzeria in Williamsburg or Artichoke Basille's Pizza. Both are highly rated and won't break the bank.\",\n", - ")\n", - "\n", - "# Verify the memories were added directly to Cosmos DB (not in local memory)\n", - "print(f\"Local memory count (should be unchanged): {len(memory.local_memory)}\\n\")\n", - "\n", - "cosmos_results = await memory.get_memories(user_id=\"user-002\", thread_id=new_thread_id)\n", - "print(f\"Memories in Cosmos DB for new thread: {len(cosmos_results)}\")\n", - "for r in cosmos_results:\n", - " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} {r['content'][:60]}\")" - ] - }, - { - "cell_type": "markdown", - "id": "b04679dd", - "metadata": {}, - "source": [ - "### 3c. Retrieve memories from Cosmos DB with `get_memories`\n", - "\n", - "Supports the same filters as `get_local`: `memory_id`, `user_id`, `role`, `memory_type`." - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "a13b2301", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:07:11.561128Z", - "start_time": "2026-04-07T22:07:11.474440Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:25:47.113447Z", - "iopub.status.busy": "2026-05-04T20:25:47.113322Z", - "iopub.status.idle": "2026-05-04T20:25:47.262048Z", - "shell.execute_reply": "2026-05-04T20:25:47.260997Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Memories for user-001: 19\n", - "\n", - " [807c3bc6...] [c6b6827e...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [807c3bc6...] [101560c2...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [807c3bc6...] [558654f4...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [c1138077...] [47eef782...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [c1138077...] [30da082b...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [c1138077...] [40665284...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [c1138077...] [c5d66e1a...] role=user type=turn Never book me into anything that departs or arrive\n", - " [807c3bc6...] [5544d374...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [807c3bc6...] [3ee542c4...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [807c3bc6...] [67cee94e...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [807c3bc6...] [afe25494...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [c1138077...] [2b7e104d...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [807c3bc6...] [bb55ae9b...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [c1138077...] [4e5b3a7d...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [c1138077...] [15f9f705...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [807c3bc6...] [97401d13...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [807c3bc6...] [3a42a459...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [807c3bc6...] [056e8fcb...] role=user type=turn And never book me into anything that departs or ar\n", - " [c1138077...] [705626cf...] role=user type=turn When picking a hotel, only recommend ones that inc\n", - "\n", - "Agent memories: 319\n", - " [26f28370...] [3f04a33a...] role=agent type=turn The PNW has amazing trails like the Wonderland Tra\n", - " [26f28370...] [afebb21e...] role=agent type=turn Running is a great way to stay fit! Do you prefer \n", - " [26f28370...] [9b9a4a3b...] role=agent type=turn Python is very popular for AI/ML workloads. What f\n", - " [96f8868c...] [afbb20b5...] role=agent type=turn Got it! You're based in Seattle working at Microso\n", - " [96f8868c...] [c175440a...] role=agent type=turn 8 years of Python experience is impressive!\n", - " [96f8868c...] [ba7a7168...] role=agent type=turn That's a great area! LLMs combined with RAG can un\n", - " [5827e67c...] [d3497550...] role=agent type=turn Spring is a wonderful time to visit Japan! Cherry \n", - " [5827e67c...] [3edcb648...] role=agent type=turn 10–14 days lets you spend ~5 days in each city plu\n", - " [5827e67c...] [679afa68...] role=agent type=turn Japan has wonderful vegetarian options — try shoji\n", - " [5827e67c...] [44bc0998...] role=agent type=turn Shigetsu inside Tenryu-ji temple is famous for its\n", - " [bec477fa...] [3e65264f...] role=agent type=turn Try aglio e olio — pasta, garlic, olive oil, chill\n", - " [bec477fa...] [9c440b51...] role=agent type=turn Italian cuisine emphasises quality ingredients pre\n", - " [800e58b0...] [966440e7...] role=agent type=turn Great itinerary! Tuscany is amazing in autumn — wi\n", - " [800e58b0...] [3f8e2989...] role=agent type=turn Brunello di Montalcino producers offer wonderful c\n", - " [a3968726...] [900a8c86...] role=agent type=turn Azure Container Apps is a great fit for FastAPI.\n", - " [a3968726...] [91cc1977...] role=agent type=turn Azure has excellent AI services — AI Foundry, AI S\n", - " [09dc7d13...] [b8be927e...] role=agent type=turn That sounds exciting! Tokyo is wonderful in spring\n", - " [09dc7d13...] [f822061c...] role=agent type=turn Great choice! Try Ain Soph in Shinjuku for plant-b\n", - " [09dc7d13...] [4f82afee...] role=agent type=turn A Suica or Pasmo IC card is the easiest option. It\n", - " [6e44bfdf...] [554813b8...] role=agent type=turn Keep a consistent sleep schedule, avoid screens 1 \n", - " [6e44bfdf...] [de33c4e1...] role=agent type=turn Yes — caffeine has a half-life of about 5-6 hours,\n", - " [d78550ff...] [415b6b5a...] role=agent type=turn Of course! Last time we discussed Ain Soph in Shin\n", - " [ticket-d...] [7dff7796...] role=agent type=turn I'm sorry to hear that. Could you share when you b\n", - " [ticket-d...] [f518daf5...] role=agent type=turn Thanks. I'll check warranty status. Could you also\n", - " [ticket-d...] [32fd980e...] role=agent type=turn Verified — the device is under warranty. I've init\n", - " [ticket-7...] [505cdf04...] role=agent type=turn Welcome back, Alex! Yes, that confirms the diagnos\n", - " [ticket-7...] [c8fc1e0a...] role=agent type=turn The Surface Dock 2 or the Anker 778 are excellent \n", - " [ticket-d...] [cdf309ab...] role=agent type=turn Welcome back, Alex! Happy to help with your Micros\n", - " [a912fa55...] [fc43544b...] role=agent type=turn PLAN:\n", - " 1. Research manufacturing impact (battery \n", - " [a912fa55...] [c898a267...] role=agent type=turn FINDING 1 — Manufacturing: EV battery production e\n", - " [a912fa55...] [00f08077...] role=agent type=turn FINDING 2 — Energy source: EVs charged on renewabl\n", - " [a912fa55...] [c2242b74...] role=agent type=turn FINDING 3 — End-of-life: Li-ion battery recycling \n", - " [a912fa55...] [277aa203...] role=agent type=turn RECOMMENDATION: For urban fleets, battery-electric\n", - " [3283e3ce...] [3347c70d...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [3283e3ce...] [7325fcca...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [3283e3ce...] [d4c2d4b1...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [93f9f763...] [0eb2219f...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [93f9f763...] [d7de15e4...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [3e8c0348...] [1c85da9a...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [3e8c0348...] [95fd0352...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [3e8c0348...] [b63df7c7...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [cc7ba964...] [eab7a8dc...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [cc7ba964...] [043b1f73...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [bfaa7891...] [3ecd376a...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [bfaa7891...] [d78560d0...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [bfaa7891...] [168452e9...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [69b363f1...] [678aae82...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [69b363f1...] [1b9459b6...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [67df7d45...] [f48762ba...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [67df7d45...] [d922da49...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [67df7d45...] [ccdb6efc...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [49296007...] [eed6a8e5...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [49296007...] [495f8e55...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [0087a4c7...] [c8444bda...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [0087a4c7...] [83b493a7...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [0087a4c7...] [1ff00508...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [a62f6290...] [bb3e7800...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [a62f6290...] [926a875e...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [154bf409...] [799c324a...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [154bf409...] [3234f409...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [154bf409...] [e635815b...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [0fcdecee...] [c2f5d5a5...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [0fcdecee...] [cba4eb09...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [t1...] [2af2a94e...] role=agent type=turn Agent response\n", - " [78ada42c...] [26821e00...] role=agent type=turn That sounds exciting! Tokyo is wonderful in spring\n", - " [78ada42c...] [104974d7...] role=agent type=turn Great choice! Try Ain Soph in Shinjuku for plant-b\n", - " [78ada42c...] [caaa7d25...] role=agent type=turn A Suica or Pasmo IC card is the easiest option. It\n", - " [dd0ad3f9...] [81fe48ff...] role=agent type=turn Keep a consistent sleep schedule, avoid screens 1 \n", - " [dd0ad3f9...] [e5b990ab...] role=agent type=turn Yes — caffeine has a half-life of about 5-6 hours,\n", - " [a402c62b...] [426026b6...] role=agent type=turn Of course! Last time we discussed Ain Soph in Shin\n", - " [e2e2402e...] [d37cf5bf...] role=agent type=turn Spring is a wonderful time to visit Japan! Cherry \n", - " [e2e2402e...] [5eebb35c...] role=agent type=turn 10–14 days lets you spend ~5 days in each city plu\n", - " [e2e2402e...] [307dc427...] role=agent type=turn Japan has wonderful vegetarian options — try shoji\n", - " [e2e2402e...] [53e01cf6...] role=agent type=turn Shigetsu inside Tenryu-ji temple is famous for its\n", - " [thread-0...] [72aadb29...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [aa7d2515...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [77886873...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-4...] [3e7ac221...] role=agent type=turn Cosmos is great\n", - " [thread-4...] [5dc2cf5b...] role=agent type=turn yes DiskANN\n", - " [thread-4...] [99f7cf33...] role=agent type=turn colocates data\n", - " [thread-0...] [0349d4e5...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [efea8437...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [3bec5407...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [3cb84a20...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [57ea857b...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [0f628302...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [06666f17...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [548dd8a9...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [bd139b4f...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-2...] [02c7e958...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-2...] [6def8d60...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-0...] [b8db28d6...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [cbf0f0be...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [771971c9...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [80f6b374...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [c5c544d6...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [2c69aa14...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [b9161808...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [a27126d6...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [98e2d8de...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [805cf355...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [7c3af0fe...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [72cdd403...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-b...] [30296030...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-b...] [a64b3ad1...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [t1...] [8422cbfd...] role=agent type=turn Agent response\n", - " [d0421430...] [47eae793...] role=agent type=turn Got it! You're based in Seattle working at Microso\n", - " [d0421430...] [13017c8c...] role=agent type=turn 8 years of Python experience is impressive!\n", - " [d0421430...] [22d94ba6...] role=agent type=turn That's a great area! LLMs combined with RAG can un\n", - " [dd381d0c...] [8f58418d...] role=agent type=turn Spring is a wonderful time to visit Japan! Cherry \n", - " [dd381d0c...] [d7e35289...] role=agent type=turn 10–14 days lets you spend ~5 days in each city plu\n", - " [dd381d0c...] [46fda2e6...] role=agent type=turn Japan has wonderful vegetarian options — try shoji\n", - " [dd381d0c...] [de105f27...] role=agent type=turn Shigetsu inside Tenryu-ji temple is famous for its\n", - " [1a5388ca...] [f64a1f54...] role=agent type=turn Try aglio e olio — pasta, garlic, olive oil, chill\n", - " [1a5388ca...] [efb3613c...] role=agent type=turn Italian cuisine emphasises quality ingredients pre\n", - " [462c0b89...] [4e8648c0...] role=agent type=turn Great itinerary! Tuscany is amazing in autumn — wi\n", - " [462c0b89...] [1fe994b2...] role=agent type=turn Brunello di Montalcino producers offer wonderful c\n", - " [82849ac6...] [24cf1624...] role=agent type=turn Azure Container Apps is a great fit for FastAPI.\n", - " [82849ac6...] [7ea3e0ac...] role=agent type=turn Azure has excellent AI services — AI Foundry, AI S\n", - " [e9d75005...] [831c50e2...] role=agent type=turn The PNW has amazing trails like the Wonderland Tra\n", - " [e9d75005...] [3e754348...] role=agent type=turn Running is a great way to stay fit! Do you prefer \n", - " [e9d75005...] [2d8ad427...] role=agent type=turn Python is very popular for AI/ML workloads. What f\n", - " [75d8811b...] [f792c4e7...] role=agent type=turn That sounds exciting! Tokyo is wonderful in spring\n", - " [75d8811b...] [8a41f22a...] role=agent type=turn Great choice! Try Ain Soph in Shinjuku for plant-b\n", - " [75d8811b...] [20f5c5de...] role=agent type=turn A Suica or Pasmo IC card is the easiest option. It\n", - " [e8f0a465...] [efcc37f1...] role=agent type=turn Keep a consistent sleep schedule, avoid screens 1 \n", - " [e8f0a465...] [d1569024...] role=agent type=turn Yes — caffeine has a half-life of about 5-6 hours,\n", - " [45853aeb...] [2094ee58...] role=agent type=turn Of course! Last time we discussed Ain Soph in Shin\n", - " [ticket-9...] [6743a768...] role=agent type=turn I'm sorry to hear that. Could you share when you b\n", - " [ticket-9...] [5cf00dc0...] role=agent type=turn Thanks. I'll check warranty status. Could you also\n", - " [ticket-9...] [3aec4d8c...] role=agent type=turn Verified — the device is under warranty. I've init\n", - " [ticket-f...] [5d5a3234...] role=agent type=turn Welcome back, Alex! Yes, that confirms the diagnos\n", - " [ticket-f...] [e2aff8e0...] role=agent type=turn The Surface Dock 2 or the Anker 778 are excellent \n", - " [ticket-b...] [c8451dd2...] role=agent type=turn Welcome back, Alex! Happy to help with your Micros\n", - " [84350066...] [cc6e41cf...] role=agent type=turn PLAN:\n", - " 1. Research manufacturing impact (battery \n", - " [84350066...] [c8a01395...] role=agent type=turn FINDING 1 — Manufacturing: EV battery production e\n", - " [84350066...] [9a5c4e1d...] role=agent type=turn FINDING 2 — Energy source: EVs charged on renewabl\n", - " [84350066...] [6b1206fd...] role=agent type=turn FINDING 3 — End-of-life: Li-ion battery recycling \n", - " [84350066...] [25903ff0...] role=agent type=turn RECOMMENDATION: For urban fleets, battery-electric\n", - " [4c99b9ba...] [d1d42c19...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [4c99b9ba...] [6587d05b...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [4c99b9ba...] [f133d14c...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [73810c6b...] [4a24bc5a...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [73810c6b...] [6037ae5b...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [34249f73...] [eb3f86b6...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [34249f73...] [81d468be...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [34249f73...] [71a3704f...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [eb1efd30...] [d943c1a2...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [eb1efd30...] [fbf6a5a9...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [ae1eb483...] [a2d755ba...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ae1eb483...] [1eabf113...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [151e417e...] [00f1ec4f...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [151e417e...] [a49ad927...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [151e417e...] [374d57e5...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [75b607c1...] [18d7b346...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [75b607c1...] [22c624a7...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [18ec5623...] [20ddefe7...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [18ec5623...] [17a3e670...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [18ec5623...] [d53dad25...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [6514d03a...] [2fbee9d5...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [6514d03a...] [08f3076a...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [thread-0...] [1f6ffd63...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [3a203195...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [a92f4b54...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [6370552e...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [e38ecbee...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [72ddcc06...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-5...] [c3c713fa...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-5...] [c7364e90...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-3...] [c527bd97...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-3...] [7371ee6c...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-0...] [95d62050...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [be0085d4...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [c09230e7...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-c...] [3582eb74...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-c...] [598dff39...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [2dec0199...] [d53348b1...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [2dec0199...] [048b347d...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [2dec0199...] [f3b2e998...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [97d1c7d2...] [45d6f3eb...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [97d1c7d2...] [61ec5e9b...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [437580e8...] [741b0b83...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [437580e8...] [ebb06dba...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [9ed6e905...] [f200bbc0...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [9ed6e905...] [59877c89...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [9ed6e905...] [9a2a651c...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [9ed6e905...] [bfb488e8...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [9ed6e905...] [0d216b3d...] role=agent type=turn Understood — I'll confirm with you before booking \n", - " [9ed6e905...] [c9b3d5ab...] role=agent type=turn Will do. I'll filter hotel suggestions to only tho\n", - " [ede78157...] [d89aa694...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ede78157...] [bda83ce2...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [e2422aed...] [0cc39f4a...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [e2422aed...] [d2d28ce4...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [e2422aed...] [a0ebc75c...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [e2422aed...] [a07d551b...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [e2422aed...] [fac38202...] role=agent type=turn Will do. I'll filter hotel suggestions to only tho\n", - " [e2422aed...] [01b514c0...] role=agent type=turn Understood — I'll confirm with you before booking \n", - " [ba2753c5...] [f62c3be1...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ba2753c5...] [5f541c2a...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [d3a73355...] [7fc1a400...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [d3a73355...] [a895d314...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [d3a73355...] [05901836...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [d3a73355...] [a762cd26...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [d3a73355...] [81ce6316...] role=agent type=turn Understood — I'll confirm with you before booking \n", - " [d3a73355...] [86a404c9...] role=agent type=turn Will do. I'll filter hotel suggestions to only tho\n", - " [e9ed3070...] [9cf12919...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [e9ed3070...] [8712d011...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [92fcfce7...] [9b497f45...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [92fcfce7...] [2ac1f955...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [92fcfce7...] [340d4e33...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [92fcfce7...] [3a3d1544...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [92fcfce7...] [ba8c8d52...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [92fcfce7...] [2485f06d...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [26392a45...] [41f1ba4d...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [26392a45...] [54cf4894...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [f0fd9a78...] [7df1661f...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [f0fd9a78...] [1f84e8ac...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [f0fd9a78...] [034bd98c...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [f0fd9a78...] [9bc141ef...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [f0fd9a78...] [51227197...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [f0fd9a78...] [f6cd2184...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [5c3287a4...] [5955e0e9...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [5c3287a4...] [9866371e...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [b48abfd4...] [04627b70...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [b48abfd4...] [8cd6cac1...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [b48abfd4...] [b022017e...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [b48abfd4...] [83a30869...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [b48abfd4...] [1d2f503d...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [b48abfd4...] [a087dfa4...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [dbdc90d0...] [8aaead6f...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [dbdc90d0...] [e2e684e6...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [a1210ca7...] [8486acee...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [a1210ca7...] [1329afa7...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [a1210ca7...] [0712700a...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [a1210ca7...] [3a6887c4...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [a1210ca7...] [9c18002a...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [a1210ca7...] [7835ebd2...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [e97abcfc...] [c40acde3...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [e97abcfc...] [25890ac3...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [8f82e8c2...] [86395b5c...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [8f82e8c2...] [f810ee90...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [8f82e8c2...] [2c53284f...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [8f82e8c2...] [03f4f090...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [8f82e8c2...] [e61823c0...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [8f82e8c2...] [de44f072...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [925c1a31...] [1bc3a721...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [925c1a31...] [81c4308b...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [925c1a31...] [bbbce8be...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [925c1a31...] [490aeb85...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [1aba6dfb...] [67c9d6d2...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [1aba6dfb...] [f973d01f...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [df2c66e2...] [885e20a1...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [df2c66e2...] [a14e680c...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [df2c66e2...] [291b33d2...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [df2c66e2...] [0085b70d...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [ae1bb147...] [49f590c9...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [ae1bb147...] [36fc3840...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [df2c66e2...] [d2b63415...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [df2c66e2...] [293d9579...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [ae1bb147...] [6d68214d...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [ae1bb147...] [88479523...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [85e74267...] [32b3911a...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [85e74267...] [2594fb41...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [1a2686a2...] [72643b0a...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [1a2686a2...] [0ce72055...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [1a2686a2...] [c91a8397...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [1a2686a2...] [b0f0f031...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [1a2686a2...] [de786284...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [1a2686a2...] [863a0e92...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [6c5e0b18...] [9d94e048...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [6c5e0b18...] [b3cac85c...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [6c5e0b18...] [bce69f91...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [6c5e0b18...] [096d24da...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [ac8cf2db...] [e388f6c6...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ac8cf2db...] [ad4aa222...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [0df5b6dc...] [26681a8e...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [0df5b6dc...] [864f087a...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [0df5b6dc...] [0cdaa994...] role=agent type=turn Got it — aisle seats only.\n", - " [0df5b6dc...] [4f35ab5b...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [0df5b6dc...] [ab9e45ba...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [bc4a98cb...] [1076e63c...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [bc4a98cb...] [6ba1d437...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [bc4a98cb...] [fcf81c7c...] role=agent type=turn Got it — aisle seats only.\n", - " [bc4a98cb...] [45e487f4...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [bc4a98cb...] [1c81ae44...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [bdd72079...] [9a99982d...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [bdd72079...] [f17db44a...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [bdd72079...] [804c1f25...] role=agent type=turn Got it — aisle seats only.\n", - " [bdd72079...] [56d4e04b...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [bdd72079...] [9857a10d...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [42b91b2c...] [aee54464...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [42b91b2c...] [2610f0f2...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [42b91b2c...] [81e4ae3f...] role=agent type=turn Got it — aisle seats only.\n", - " [42b91b2c...] [88c29041...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [42b91b2c...] [aec0a2ba...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [e50f775e...] [88a718fa...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [e50f775e...] [5d25077d...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [e50f775e...] [4f8721a6...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [e50f775e...] [3f00a18c...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [e50f775e...] [4d4926ec...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [e50f775e...] [96aa9017...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [8f42e1b5...] [26ba3a10...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [8f42e1b5...] [2430022a...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [8f42e1b5...] [300757b0...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [8f42e1b5...] [c997e440...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [7b8fc78b...] [0e5d8a0a...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [7b8fc78b...] [c0437ffe...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [807c3bc6...] [c6b6827e...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [807c3bc6...] [101560c2...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [c1138077...] [30da082b...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [c1138077...] [40665284...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [807c3bc6...] [3ee542c4...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [807c3bc6...] [67cee94e...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [c1138077...] [2b7e104d...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [c1138077...] [4e5b3a7d...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [807c3bc6...] [97401d13...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [807c3bc6...] [3a42a459...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [6b59bbaf...] [6a66be86...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [6b59bbaf...] [546aff6a...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n" - ] - } - ], - "source": [ - "# Get all memories for user-001\n", - "results = await memory.get_memories(user_id=USER_ID)\n", - "print(f\"Memories for user-001: {len(results)}\\n\")\n", - "for r in results:\n", - " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} type={r['type']:<8} {r['content'][:50]}\")\n", - "\n", - "# Get only agent memories\n", - "agent_results = await memory.get_memories(role=\"agent\")\n", - "print(f\"\\nAgent memories: {len(agent_results)}\")\n", - "for r in agent_results:\n", - " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} type={r['type']:<8} {r['content'][:50]}\")" - ] - }, - { - "cell_type": "markdown", - "id": "7e98a7c2", - "metadata": {}, - "source": [ - "### 3d. Update & Delete in Cosmos DB\n", - "\n", - "If the content changes, the embedding is automatically re-generated (awaited)." - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "b0b61df9", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:07:16.784062Z", - "start_time": "2026-04-07T22:07:16.651689Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:25:47.264618Z", - "iopub.status.busy": "2026-05-04T20:25:47.264449Z", - "iopub.status.idle": "2026-05-04T20:25:47.395572Z", - "shell.execute_reply": "2026-05-04T20:25:47.394909Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Before: Something near Pike Place Market would be great. Keep flights under $300 round trip and hotels under $200/night.\n", - "\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "After: Something near Pike Place Market would be great. Keep flights under $300 round trip and hotels under $200/night.\n" - ] - } - ], - "source": [ - "# Update the user's budget message to add a hotel budget constraint\n", - "user_msgs = await memory.get_memories(user_id=USER_ID, role=\"user\")\n", - "target = [m for m in user_msgs if \"Pike Place\" in m[\"content\"]][0]\n", - "print(f\"Before: {target['content']}\\n\")\n", - "\n", - "await memory.update_cosmos(\n", - " memory_id=target[\"id\"],\n", - " content=\"Something near Pike Place Market would be great. Keep flights under $300 round trip and hotels under $200/night.\",\n", - " metadata={\"edited\": True, \"reason\": \"user clarified hotel budget\"},\n", - ")\n", - "\n", - "updated = (await memory.get_memories(memory_id=target[\"id\"]))[0]\n", - "print(f\"After: {updated['content']}\")" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "74874763", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:07:36.933417Z", - "start_time": "2026-04-07T22:07:36.641107Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:25:47.397837Z", - "iopub.status.busy": "2026-05-04T20:25:47.397690Z", - "iopub.status.idle": "2026-05-04T20:25:50.012907Z", - "shell.execute_reply": "2026-05-04T20:25:50.012517Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'id': '17c87803-34e3-4410-ba71-0f16d867141d', 'user_id': 'user-002', 'thread_id': '6b59bbaf-a9ba-4122-a67b-f18ce950ec2d', 'role': 'tool', 'type': 'turn', 'content': '{\"query\": \"top restaurants NYC\", \"results\": [\"Carbone\", \"Nobu\", \"Katz\\'s Deli\", \"Le Bernardin\"]}', 'metadata': {'tool_name': 'restaurant_search', 'tool_call_id': 'call_abc123'}, 'created_at': '2026-05-04T20:25:46.986153+00:00', 'tags': [], '_rid': 'EShyAMqZjm9EMjEBAAAAAA==', '_self': 'dbs/EShyAA==/colls/EShyAMqZjm8=/docs/EShyAMqZjm9EMjEBAAAAAA==/', '_etag': '\"00006c06-0000-0800-0000-69f900cb0000\"', '_attachments': 'attachments/', '_ts': 1777926347}\n", - "Deleted tool memory 17c87803...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "Remaining memories in Cosmos DB: 1024\n", - " [9060aacb...] [fact_31f...] role=system type=fact The user is building a recommendation engine for a\n", - " [9060aacb...] [fact_24c...] role=system type=fact The user chose a hybrid recommendation approach co\n", - " [9060aacb...] [fact_801...] role=system type=fact The user plans to use embeddings generated from bo\n", - " [9060aacb...] [fact_9e2...] role=system type=fact The user prefers Python for development.\n", - " [9060aacb...] [fact_d31...] role=system type=fact The user wants to use FastAPI for the API layer of\n", - " [9060aacb...] [ep_63631...] role=system type=episodic Last quarter, the user implemented a similar recom\n", - " [9060aacb...] [summary_...] role=system type=summary The user discussed building a hybrid recommendatio\n", - " [26f28370...] [050930c1...] role=user type=turn I love hiking in the Pacific Northwest\n", - " [26f28370...] [3f04a33a...] role=agent type=turn The PNW has amazing trails like the Wonderland Tra\n", - " [26f28370...] [1286f137...] role=user type=turn I usually run 5 miles every morning before work\n", - " [26f28370...] [afebb21e...] role=agent type=turn Running is a great way to stay fit! Do you prefer \n", - " [26f28370...] [9b9a4a3b...] role=agent type=turn Python is very popular for AI/ML workloads. What f\n", - " [96f8868c...] [6f2b06d0...] role=user type=turn I live in Seattle and work at Microsoft as a softw\n", - " [96f8868c...] [afbb20b5...] role=agent type=turn Got it! You're based in Seattle working at Microso\n", - " [96f8868c...] [f3ed4abc...] role=user type=turn My favourite programming language is Python and I'\n", - " [96f8868c...] [c175440a...] role=agent type=turn 8 years of Python experience is impressive!\n", - " [96f8868c...] [b14f468d...] role=user type=turn I'm currently working on a project involving large\n", - " [96f8868c...] [ba7a7168...] role=agent type=turn That's a great area! LLMs combined with RAG can un\n", - " [96f8868c...] [b10d9418...] role=user type=turn Last spring I went hiking on Mount Rainier with my\n", - " [96f8868c...] [8adba5c7...] role=user type=turn When debugging an LLM, always check the prompt fir\n", - " [96f8868c...] [fact_486...] role=system type=fact The user lives in Seattle.\n", - " [96f8868c...] [fact_c52...] role=system type=fact The user works at Microsoft as a software engineer\n", - " [96f8868c...] [fact_af9...] role=system type=fact The user's favorite programming language is Python\n", - " [96f8868c...] [fact_08a...] role=system type=fact The user has 8 years of experience using Python.\n", - " [96f8868c...] [fact_117...] role=system type=fact The user is currently working on a project involvi\n", - " [96f8868c...] [fact_ee1...] role=system type=fact The user has a dog.\n", - " [__proced...] [proc_616...] role=system type=procedural When debugging a large language model, always chec\n", - " [96f8868c...] [ep_13a6b...] role=system type=episodic Last spring, the user went hiking on Mount Rainier\n", - " [5827e67c...] [3782ffef...] role=user type=turn I'm planning a trip to Japan next spring. Any sugg\n", - " [5827e67c...] [d3497550...] role=agent type=turn Spring is a wonderful time to visit Japan! Cherry \n", - " [5827e67c...] [8717fe0d...] role=user type=turn I'd love to see Kyoto and Tokyo. How long should I\n", - " [5827e67c...] [3edcb648...] role=agent type=turn 10–14 days lets you spend ~5 days in each city plu\n", - " [5827e67c...] [summary_...] role=system type=summary The user planned a spring trip to Japan focused on\n", - " [5827e67c...] [30f39fca...] role=user type=turn What about food? I'm a vegetarian.\n", - " [5827e67c...] [679afa68...] role=agent type=turn Japan has wonderful vegetarian options — try shoji\n", - " [5827e67c...] [20418cbb...] role=user type=turn Are there any vegetarian restaurants you'd recomme\n", - " [5827e67c...] [44bc0998...] role=agent type=turn Shigetsu inside Tenryu-ji temple is famous for its\n", - " [bec477fa...] [410dcaf7...] role=user type=turn What's a good pasta recipe for a weeknight dinner?\n", - " [bec477fa...] [3e65264f...] role=agent type=turn Try aglio e olio — pasta, garlic, olive oil, chill\n", - " [bec477fa...] [93d8e2c1...] role=user type=turn Sounds great. I love simple Italian food, especial\n", - " [bec477fa...] [9c440b51...] role=agent type=turn Italian cuisine emphasises quality ingredients pre\n", - " [bec477fa...] [fact_584...] role=system type=fact The user prefers simple Italian food, especially d\n", - " [bec477fa...] [summary_...] role=system type=summary The conversation focused on suggesting a simple pa\n", - " [800e58b0...] [bc01e3d3...] role=user type=turn I want to visit Italy next year — Rome, Florence, \n", - " [800e58b0...] [966440e7...] role=agent type=turn Great itinerary! Tuscany is amazing in autumn — wi\n", - " [800e58b0...] [b1134253...] role=user type=turn Perfect — I love wine, especially Chianti and Brun\n", - " [800e58b0...] [3f8e2989...] role=agent type=turn Brunello di Montalcino producers offer wonderful c\n", - " [800e58b0...] [fact_bfd...] role=system type=fact The user plans to visit Italy next year, including\n", - " [800e58b0...] [fact_070...] role=system type=fact The user loves wine, especially Chianti and Brunel\n", - " [800e58b0...] [summary_...] role=system type=summary The user discussed plans to visit Italy next year,\n", - " [a3968726...] [80c78945...] role=user type=turn What's the best way to deploy a Python FastAPI app\n", - " [a3968726...] [900a8c86...] role=agent type=turn Azure Container Apps is a great fit for FastAPI.\n", - " [a3968726...] [00c996bc...] role=user type=turn Cool. I'm a Python engineer building AI tooling.\n", - " [a3968726...] [91cc1977...] role=agent type=turn Azure has excellent AI services — AI Foundry, AI S\n", - " [a3968726...] [fact_423...] role=system type=fact The user is a Python engineer building AI tooling.\n", - " [a3968726...] [summary_...] role=system type=summary The conversation focused on the best way to deploy\n", - " [__user_s...] [user_sum...] role=system type=user_summary The user is a Python engineer building AI tooling.\n", - " [09dc7d13...] [a313f4fe...] role=user type=turn Hi! I'm planning a trip to Tokyo next month.\n", - " [09dc7d13...] [b8be927e...] role=agent type=turn That sounds exciting! Tokyo is wonderful in spring\n", - " [09dc7d13...] [a048b3cd...] role=user type=turn I'd love food recommendations. I'm vegetarian.\n", - " [09dc7d13...] [f822061c...] role=agent type=turn Great choice! Try Ain Soph in Shinjuku for plant-b\n", - " [09dc7d13...] [6c05d0fc...] role=user type=turn Also, what's the best way to get around the city?\n", - " [09dc7d13...] [4f82afee...] role=agent type=turn A Suica or Pasmo IC card is the easiest option. It\n", - " [6e44bfdf...] [5f70d499...] role=user type=turn I've been having trouble sleeping lately. Any tips\n", - " [6e44bfdf...] [554813b8...] role=agent type=turn Keep a consistent sleep schedule, avoid screens 1 \n", - " [6e44bfdf...] [ceb47ce6...] role=user type=turn Does caffeine really affect sleep that much?\n", - " [6e44bfdf...] [de33c4e1...] role=agent type=turn Yes — caffeine has a half-life of about 5-6 hours,\n", - " [d78550ff...] [d78c85d4...] role=user type=turn Can you remind me of the Tokyo restaurant suggesti\n", - " [d78550ff...] [415b6b5a...] role=agent type=turn Of course! Last time we discussed Ain Soph in Shin\n", - " [ticket-d...] [d6a1be75...] role=user type=turn Hi, I'm having issues with my Surface Pro 9. The b\n", - " [ticket-d...] [7dff7796...] role=agent type=turn I'm sorry to hear that. Could you share when you b\n", - " [ticket-d...] [318d37d4...] role=user type=turn I bought it in March 2024 from the Microsoft Store\n", - " [ticket-d...] [f518daf5...] role=agent type=turn Thanks. I'll check warranty status. Could you also\n", - " [ticket-d...] [902ed190...] role=user type=turn It's alex.chen@example.com. The order number was M\n", - " [ticket-d...] [32fd980e...] role=agent type=turn Verified — the device is under warranty. I've init\n", - " [ticket-d...] [630500b2...] role=user type=turn OK, will do. By the way, I work as a software engi\n", - " [ticket-d...] [fact_b48...] role=system type=fact The user owns a Surface Pro 9 with a battery that \n", - " [ticket-d...] [fact_55f...] role=system type=fact The user purchased the Surface Pro 9 in March 2024\n", - " [ticket-d...] [fact_812...] role=system type=fact The user's email address is alex.chen@example.com.\n", - " [ticket-d...] [fact_68e...] role=system type=fact The Surface Pro 9 order number is MS-78234.\n", - " [ticket-d...] [fact_fe9...] role=system type=fact The user's Surface Pro 9 is currently under warran\n", - " [ticket-d...] [fact_198...] role=system type=fact The user works as a software engineer and relies o\n", - " [ticket-d...] [fact_369...] role=system type=fact The user will run the Surface app battery diagnost\n", - " [ticket-d...] [summary_...] role=system type=summary The user reported that their Surface Pro 9 battery\n", - " [ticket-7...] [59d28891...] role=user type=turn Hello again — Alex from the previous battery ticke\n", - " [ticket-7...] [505cdf04...] role=agent type=turn Welcome back, Alex! Yes, that confirms the diagnos\n", - " [ticket-7...] [4c3d1d55...] role=user type=turn Great. While we're talking, can you recommend a US\n", - " [ticket-7...] [c8fc1e0a...] role=agent type=turn The Surface Dock 2 or the Anker 778 are excellent \n", - " [ticket-7...] [f5cf5370...] role=user type=turn Multi-monitor is exactly what I need — I run 3 dis\n", - " [ticket-7...] [fact_032...] role=system type=fact The user's name is Alex.\n", - " [ticket-7...] [fact_ba5...] role=system type=fact The Surface app diagnostic reports that the user's\n", - " [ticket-7...] [fact_64c...] role=system type=fact Alex requires a USB-C dock compatible with the Sur\n", - " [ticket-7...] [summary_...] role=system type=summary Alex contacted support regarding a degraded batter\n", - " [__user_s...] [user_sum...] role=system type=user_summary The user's name is Alex.; The user's email address\n", - " [ticket-d...] [f6741f54...] role=user type=turn Hi, I have a quick question about my Microsoft 365\n", - " [ticket-d...] [cdf309ab...] role=agent type=turn Welcome back, Alex! Happy to help with your Micros\n", - " [a912fa55...] [975d78b5...] role=user type=turn Compare the environmental impact of electric vehic\n", - " [a912fa55...] [fc43544b...] role=agent type=turn PLAN:\n", - " 1. Research manufacturing impact (battery \n", - " [a912fa55...] [c898a267...] role=agent type=turn FINDING 1 — Manufacturing: EV battery production e\n", - " [a912fa55...] [00f08077...] role=agent type=turn FINDING 2 — Energy source: EVs charged on renewabl\n", - " [a912fa55...] [c2242b74...] role=agent type=turn FINDING 3 — End-of-life: Li-ion battery recycling \n", - " [a912fa55...] [277aa203...] role=agent type=turn RECOMMENDATION: For urban fleets, battery-electric\n", - " [thread-0...] [f844e873...] role=system type=fact User prefers Python over Java for backend work\n", - " [thread-0...] [d54ab12f...] role=system type=fact User is allergic to peanuts\n", - " [thread-0...] [24cf3d6a...] role=system type=fact User lives in Seattle, WA\n", - " [thread-0...] [323d880f...] role=system type=episodic Last Friday the user shipped a Cosmos-backed searc\n", - " [thread-0...] [b6c5a9ab...] role=system type=episodic User attended PyCon 2024 in Pittsburgh\n", - " [thread-0...] [b18fc854...] role=system type=procedural When the user says 'deploy', run `azd up` and tail\n", - " [thread-0...] [ce09b345...] role=system type=procedural Always confirm before purging Cosmos containers\n", - " [thread-5...] [fe918ee7...] role=system type=episodic Last Friday the user shipped a Cosmos-backed searc\n", - " [thread-5...] [31426409...] role=system type=episodic User attended PyCon 2024 in Pittsburgh\n", - " [thread-5...] [52d4d63f...] role=system type=procedural When the user says 'deploy', run `azd up` and tail\n", - " [thread-5...] [9ec66aac...] role=system type=procedural Always confirm before purging Cosmos containers\n", - " [3283e3ce...] [44e2a84b...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [3283e3ce...] [3347c70d...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [3283e3ce...] [7325fcca...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [3283e3ce...] [1548d960...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [3283e3ce...] [d4c2d4b1...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [93f9f763...] [b19855ba...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [93f9f763...] [0eb2219f...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [93f9f763...] [61ada8c9...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [93f9f763...] [d7de15e4...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [3283e3ce...] [summary_...] role=system type=summary The user planned a weekend trip to Seattle with sp\n", - " [3283e3ce...] [fact_6dd...] role=system type=fact For a weekend trip to Seattle, the user requires r\n", - " [3283e3ce...] [fact_7a7...] role=system type=fact For a weekend trip to Seattle, the user requires h\n", - " [3283e3ce...] [fact_07e...] role=system type=fact For a weekend trip to Seattle, the user prefers ac\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [9269dfde...] [6550cc6e...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [9269dfde...] [2b249321...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [9269dfde...] [ccced81a...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [3e8c0348...] [1c85da9a...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [3e8c0348...] [ad231b3b...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [3e8c0348...] [0eba1fb4...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [3e8c0348...] [95fd0352...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [3e8c0348...] [b63df7c7...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [cc7ba964...] [5a1dd03f...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [cc7ba964...] [eab7a8dc...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [cc7ba964...] [e353165a...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [cc7ba964...] [043b1f73...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [bfaa7891...] [1899de86...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [bfaa7891...] [3ecd376a...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [bfaa7891...] [d78560d0...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [bfaa7891...] [168452e9...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [bfaa7891...] [352b0816...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [69b363f1...] [12da5f11...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [69b363f1...] [678aae82...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [69b363f1...] [f282cce3...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [69b363f1...] [1b9459b6...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [67df7d45...] [f48762ba...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [67df7d45...] [d922da49...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [67df7d45...] [ccdb6efc...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [67df7d45...] [eece0053...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [67df7d45...] [78c59756...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [49296007...] [525fa21b...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [49296007...] [eed6a8e5...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [49296007...] [817d2b13...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [49296007...] [495f8e55...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [0087a4c7...] [7112974f...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [0087a4c7...] [c8444bda...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [0087a4c7...] [aca1086e...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [0087a4c7...] [83b493a7...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [0087a4c7...] [1ff00508...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [a62f6290...] [3ca18d6c...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [a62f6290...] [bb3e7800...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [a62f6290...] [9fd37b3a...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [a62f6290...] [926a875e...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [64930fb1...] [a67d7b29...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [64930fb1...] [2ccb8a00...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [64930fb1...] [10c23217...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [154bf409...] [c9f3116a...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [154bf409...] [799c324a...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [154bf409...] [3234f409...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [154bf409...] [e635815b...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [154bf409...] [c8dc5c13...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [0fcdecee...] [ddc8b396...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [0fcdecee...] [c2f5d5a5...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [0fcdecee...] [f03aa200...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [0fcdecee...] [cba4eb09...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [3283e3ce...] [ep_420f4...] role=system type=episodic The user was planning a weekend trip to Seattle an\n", - " [30b8b16c...] [913e5379...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [30b8b16c...] [e5e45fef...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [30b8b16c...] [08dddc67...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [t1...] [2af2a94e...] role=agent type=turn Agent response\n", - " [78ada42c...] [d288134a...] role=user type=turn Hi! I'm planning a trip to Tokyo next month.\n", - " [78ada42c...] [26821e00...] role=agent type=turn That sounds exciting! Tokyo is wonderful in spring\n", - " [78ada42c...] [bd2d2b5e...] role=user type=turn I'd love food recommendations. I'm vegetarian.\n", - " [78ada42c...] [104974d7...] role=agent type=turn Great choice! Try Ain Soph in Shinjuku for plant-b\n", - " [78ada42c...] [22e034f0...] role=user type=turn Also, what's the best way to get around the city?\n", - " [78ada42c...] [caaa7d25...] role=agent type=turn A Suica or Pasmo IC card is the easiest option. It\n", - " [dd0ad3f9...] [039bf606...] role=user type=turn I've been having trouble sleeping lately. Any tips\n", - " [dd0ad3f9...] [81fe48ff...] role=agent type=turn Keep a consistent sleep schedule, avoid screens 1 \n", - " [dd0ad3f9...] [5cb804de...] role=user type=turn Does caffeine really affect sleep that much?\n", - " [dd0ad3f9...] [e5b990ab...] role=agent type=turn Yes — caffeine has a half-life of about 5-6 hours,\n", - " [a402c62b...] [b5efa043...] role=user type=turn Can you remind me of the Tokyo restaurant suggesti\n", - " [a402c62b...] [426026b6...] role=agent type=turn Of course! Last time we discussed Ain Soph in Shin\n", - " [e2e2402e...] [a2ebd8fc...] role=user type=turn I'm planning a trip to Japan next spring. Any sugg\n", - " [e2e2402e...] [d37cf5bf...] role=agent type=turn Spring is a wonderful time to visit Japan! Cherry \n", - " [e2e2402e...] [e3e3d7ce...] role=user type=turn I'd love to see Kyoto and Tokyo. How long should I\n", - " [e2e2402e...] [5eebb35c...] role=agent type=turn 10–14 days lets you spend ~5 days in each city plu\n", - " [e2e2402e...] [summary_...] role=system type=summary The user planned a spring trip to Japan focused on\n", - " [e2e2402e...] [f194f077...] role=user type=turn What about food? I'm a vegetarian.\n", - " [e2e2402e...] [307dc427...] role=agent type=turn Japan has wonderful vegetarian options — try shoji\n", - " [e2e2402e...] [ba7e6fe2...] role=user type=turn Are there any vegetarian restaurants you'd recomme\n", - " [e2e2402e...] [53e01cf6...] role=agent type=turn Shigetsu inside Tenryu-ji temple is famous for its\n", - " [thread-0...] [f4734224...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [d5e42a3c...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [72aadb29...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [1cc0c040...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [aa7d2515...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [5eddb02b...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [77886873...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [6099050f...] role=system type=fact The user loves Azure Cosmos DB.\n", - " [thread-0...] [b0c0dd47...] role=system type=fact Azure Cosmos DB supports vector search powered by \n", - " [thread-0...] [summary_...] role=system type=summary The conversation consisted of brief exchanges abou\n", - " [thread-0...] [6bb1605b...] role=system type=fact Azure Cosmos DB supports hierarchical partition ke\n", - " [thread-4...] [a38d21e1...] role=user type=turn Hi I love Cosmos\n", - " [thread-4...] [3e7ac221...] role=agent type=turn Cosmos is great\n", - " [thread-4...] [8a13148e...] role=user type=turn vector search?\n", - " [thread-4...] [5dc2cf5b...] role=agent type=turn yes DiskANN\n", - " [thread-4...] [f555f850...] role=user type=turn HPK?\n", - " [thread-4...] [99f7cf33...] role=agent type=turn colocates data\n", - " [thread-4...] [summary_...] role=system type=summary The conversation briefly touched on Microsoft Azur\n", - " [thread-0...] [58d255e2...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [0349d4e5...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [13a6491b...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [efea8437...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [8ce337ef...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [3bec5407...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-9...] [bc800311...] role=user type=turn I'm planning a hiking trip to Olympic National Par\n", - " [__user_s...] [user_sum...] role=system type=user_summary The user lives in Seattle, WA.; The user is allerg\n", - " [thread-0...] [aa91e94e...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [3cb84a20...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [02c03996...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [57ea857b...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [9055c362...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [0f628302...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [793a5ee5...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [06666f17...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [d208eeea...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [548dd8a9...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [978dcff8...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [bd139b4f...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-2...] [79fca8cc...] role=user type=turn I'm planning a hiking trip to Olympic National Par\n", - " [thread-2...] [02c7e958...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-2...] [89959614...] role=user type=turn I'd like to camp 2 nights. Any permit guidance?\n", - " [thread-2...] [6def8d60...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-2...] [8b910b34...] role=user type=turn Thanks — also, I'm vegetarian, please remember tha\n", - " [thread-2...] [summary_...] role=system type=summary The user discussed planning a hiking and camping t\n", - " [thread-2...] [fact_0c0...] role=system type=fact The user is planning a hiking trip to Olympic Nati\n", - " [thread-2...] [fact_206...] role=system type=fact The user plans to camp for two nights during the O\n", - " [thread-2...] [fact_b39...] role=system type=fact The user follows a vegetarian diet.\n", - " [test-thr...] [3c31c8da...] role=user type=turn Test message 214ecc\n", - " [test-thr...] [9380bb97...] role=user type=turn Test message 6e6446\n", - " [test-thr...] [1944068a...] role=user type=turn Test message 0eff02\n", - " [test-thr...] [summary_...] role=system type=summary The user sent three short test messages containing\n", - " [e9cdb066...] [fact_ade...] role=system type=fact The user lives in Seattle.\n", - " [e9cdb066...] [fact_716...] role=system type=fact The user works at Microsoft as a software engineer\n", - " [e9cdb066...] [fact_cfe...] role=system type=fact The user prefers Python over JavaScript for backen\n", - " [__proced...] [proc_6a4...] role=system type=procedural When asked about deployment, always check the reso\n", - " [e9cdb066...] [ep_4a734...] role=system type=episodic The user traveled to Japan during cherry blossom s\n", - " [5672dff1...] [summary_...] role=system type=summary The user shared details about their daily running \n", - " [f28bdc49...] [summary_...] role=system type=summary The user shared their enthusiasm for Italian cooki\n", - " [5672dff1...] [fact_8da...] role=system type=fact The user goes running every morning before work, c\n", - " [f28bdc49...] [fact_512...] role=system type=fact The user loves Italian cooking, especially pasta.\n", - " [f28bdc49...] [fact_661...] role=system type=fact The user makes homemade fettuccine every weekend.\n", - " [test-thr...] [e8afd5dd...] role=user type=turn Test message ac3aa2\n", - " [test-thr...] [ecce99ca...] role=user type=turn Test message 15ec87\n", - " [test-thr...] [a43a8567...] role=user type=turn Test message fca3a8\n", - " [test-thr...] [summary_...] role=system type=summary The user sent three separate test messages contain\n", - " [test-thr...] [94c5afad...] role=user type=turn Test message e4a27e\n", - " [test-thr...] [476a9588...] role=user type=turn Test message 330890\n", - " [test-thr...] [4bdf8f28...] role=user type=turn Test message 506cf6\n", - " [test-thr...] [summary_...] role=system type=summary The conversation consisted of three standalone tes\n", - " [5622a10b...] [fact_cb8...] role=system type=fact The user lives in Seattle.\n", - " [5622a10b...] [fact_493...] role=system type=fact The user works at Microsoft as a software engineer\n", - " [5622a10b...] [fact_a13...] role=system type=fact The user prefers Python over JavaScript for backen\n", - " [__proced...] [proc_1f4...] role=system type=procedural When discussing deployment, always check the resou\n", - " [5622a10b...] [ep_0d448...] role=system type=episodic The user traveled to Japan during cherry blossom s\n", - " [c90da0a1...] [summary_...] role=system type=summary The conversation was a brief exchange about the us\n", - " [c90da0a1...] [fact_e6a...] role=system type=fact The user loves Italian cooking, especially pasta.\n", - " [c90da0a1...] [fact_d86...] role=system type=fact The user makes homemade fettuccine every weekend.\n", - " [thread-0...] [3771c68f...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [b8db28d6...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [8f280507...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [cbf0f0be...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [7bc1a0bd...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [771971c9...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [638e47a9...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [80f6b374...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [7207f7da...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [c5c544d6...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [ec28abb0...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [2c69aa14...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [test-thr...] [eb09e3b8...] role=user type=turn Test message c67925\n", - " [test-thr...] [390f2924...] role=user type=turn Test message 5c0bc7\n", - " [test-thr...] [9c356b00...] role=user type=turn Test message 075f33\n", - " [test-thr...] [summary_...] role=system type=summary The user sent three separate test messages contain\n", - " [c60acfe1...] [fact_9eb...] role=system type=fact The user lives in Seattle.\n", - " [c60acfe1...] [fact_a13...] role=system type=fact The user works at Microsoft as a software engineer\n", - " [c60acfe1...] [fact_6e6...] role=system type=fact The user prefers Python over JavaScript for backen\n", - " [__proced...] [proc_699...] role=system type=procedural When discussing deployment, always check the resou\n", - " [c60acfe1...] [ep_a1e72...] role=system type=episodic The user traveled to Japan during cherry blossom s\n", - " [08a365ae...] [fact_d32...] role=system type=fact The user makes homemade fettuccine every weekend.\n", - " [08a365ae...] [summary_...] role=system type=summary The user shared their enthusiasm for Italian cooki\n", - " [4d28c3df...] [fact_b23...] role=system type=fact The user runs approximately 5 kilometres each day.\n", - " [4d28c3df...] [summary_...] role=system type=summary The conversation was about the user’s daily runnin\n", - " [test-thr...] [3cb4cee8...] role=user type=turn Test message 396b1a\n", - " [test-thr...] [ee9ba6ab...] role=user type=turn Test message ce1cff\n", - " [test-thr...] [0c4ad50f...] role=user type=turn Test message 35de30\n", - " [test-thr...] [summary_...] role=system type=summary The conversation consisted of three short test mes\n", - " [6a0c8737...] [fact_318...] role=system type=fact The user lives in Seattle.\n", - " [6a0c8737...] [fact_c00...] role=system type=fact The user works at Microsoft as a software engineer\n", - " [6a0c8737...] [fact_234...] role=system type=fact The user prefers Python over JavaScript for backen\n", - " [__proced...] [proc_1f2...] role=system type=procedural When asked about deployment, always check the reso\n", - " [6a0c8737...] [ep_b5220...] role=system type=episodic The user traveled to Japan during cherry blossom s\n", - " [a8ea2e65...] [fact_7b9...] role=system type=fact The user goes running every morning before work, t\n", - " [8216c24f...] [fact_31f...] role=system type=fact The user enjoys Italian cooking, especially pasta \n", - " [8216c24f...] [fact_7ba...] role=system type=fact The user makes homemade fettuccine every weekend.\n", - " [cc830eaa...] [fact_7d5...] role=system type=fact The user has a golden retriever named Buddy.\n", - " [cc830eaa...] [fact_b66...] role=system type=fact Buddy is 3 years old.\n", - " [cc830eaa...] [fact_8b1...] role=system type=fact Buddy loves playing fetch at the park.\n", - " [thread-0...] [f4d39b04...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [b9161808...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [c3a74683...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [a27126d6...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [91c3e7dc...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [98e2d8de...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [cd0271bc...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [805cf355...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [826c773c...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [7c3af0fe...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [012f758c...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [72cdd403...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-b...] [9b72c25d...] role=user type=turn I'm planning a hiking trip to Olympic National Par\n", - " [thread-b...] [30296030...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-b...] [efabc25b...] role=user type=turn I'd like to camp 2 nights. Any permit guidance?\n", - " [thread-b...] [a64b3ad1...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-b...] [105b6260...] role=user type=turn Thanks — also, I'm vegetarian, please remember tha\n", - " [thread-b...] [summary_...] role=system type=summary The user discussed planning a hiking trip to Olymp\n", - " [t1...] [b7bbcd71...] role=user type=turn Hello from quickstart!\n", - " [t1...] [8422cbfd...] role=agent type=turn Agent response\n", - " [d0421430...] [5cb583cf...] role=user type=turn I live in Seattle and work at Microsoft as a softw\n", - " [d0421430...] [47eae793...] role=agent type=turn Got it! You're based in Seattle working at Microso\n", - " [d0421430...] [7ae79706...] role=user type=turn My favourite programming language is Python and I'\n", - " [d0421430...] [13017c8c...] role=agent type=turn 8 years of Python experience is impressive!\n", - " [d0421430...] [76abf10b...] role=user type=turn I'm currently working on a project involving large\n", - " [d0421430...] [22d94ba6...] role=agent type=turn That's a great area! LLMs combined with RAG can un\n", - " [d0421430...] [5b337ad5...] role=user type=turn Last spring I went hiking on Mount Rainier with my\n", - " [d0421430...] [b019f3b9...] role=user type=turn When debugging an LLM, always check the prompt fir\n", - " [d0421430...] [fact_ab2...] role=system type=fact The user lives in Seattle.\n", - " [d0421430...] [fact_f60...] role=system type=fact The user works at Microsoft as a software engineer\n", - " [d0421430...] [fact_0f6...] role=system type=fact The user's favourite programming language is Pytho\n", - " [d0421430...] [fact_83f...] role=system type=fact The user has 8 years of experience using Python.\n", - " [d0421430...] [fact_606...] role=system type=fact The user is currently working on a project involvi\n", - " [__proced...] [proc_1d3...] role=system type=procedural When debugging a large language model, always chec\n", - " [d0421430...] [ep_c4c50...] role=system type=episodic Last spring, the user went hiking on Mount Rainier\n", - " [dd381d0c...] [8a755754...] role=user type=turn I'm planning a trip to Japan next spring. Any sugg\n", - " [dd381d0c...] [8f58418d...] role=agent type=turn Spring is a wonderful time to visit Japan! Cherry \n", - " [dd381d0c...] [59506060...] role=user type=turn I'd love to see Kyoto and Tokyo. How long should I\n", - " [dd381d0c...] [d7e35289...] role=agent type=turn 10–14 days lets you spend ~5 days in each city plu\n", - " [d0421430...] [summary_...] role=system type=summary The user shared personal and professional backgrou\n", - " [d0421430...] [fact_58d...] role=system type=fact The user's favorite programming language is Python\n", - " [d0421430...] [fact_9de...] role=system type=fact The user is currently working on a project involvi\n", - " [d0421430...] [ep_918b6...] role=system type=episodic Last spring, the user went hiking on Mount Rainier\n", - " [dd381d0c...] [summary_...] role=system type=summary The user planned a spring trip to Japan focused on\n", - " [dd381d0c...] [50dd67ed...] role=user type=turn What about food? I'm a vegetarian.\n", - " [dd381d0c...] [46fda2e6...] role=agent type=turn Japan has wonderful vegetarian options — try shoji\n", - " [dd381d0c...] [747e073c...] role=user type=turn Are there any vegetarian restaurants you'd recomme\n", - " [dd381d0c...] [de105f27...] role=agent type=turn Shigetsu inside Tenryu-ji temple is famous for its\n", - " [dd381d0c...] [fact_982...] role=system type=fact The user is planning a trip to Japan next spring.\n", - " [dd381d0c...] [fact_cd7...] role=system type=fact The user wants to visit Kyoto and Tokyo during the\n", - " [dd381d0c...] [fact_555...] role=system type=fact The user follows a vegetarian diet.\n", - " [1a5388ca...] [553b498c...] role=user type=turn What's a good pasta recipe for a weeknight dinner?\n", - " [1a5388ca...] [f64a1f54...] role=agent type=turn Try aglio e olio — pasta, garlic, olive oil, chill\n", - " [1a5388ca...] [fa9e29e3...] role=user type=turn Sounds great. I love simple Italian food, especial\n", - " [1a5388ca...] [efb3613c...] role=agent type=turn Italian cuisine emphasises quality ingredients pre\n", - " [1a5388ca...] [fact_aa1...] role=system type=fact The user prefers simple Italian food made with fre\n", - " [1a5388ca...] [fact_088...] role=system type=fact The user loves simple Italian food, especially dis\n", - " [1a5388ca...] [summary_...] role=system type=summary The user asked for a good weeknight pasta recipe a\n", - " [462c0b89...] [5148d545...] role=user type=turn I want to visit Italy next year — Rome, Florence, \n", - " [462c0b89...] [4e8648c0...] role=agent type=turn Great itinerary! Tuscany is amazing in autumn — wi\n", - " [462c0b89...] [aedd2520...] role=user type=turn Perfect — I love wine, especially Chianti and Brun\n", - " [462c0b89...] [1fe994b2...] role=agent type=turn Brunello di Montalcino producers offer wonderful c\n", - " [462c0b89...] [fact_82d...] role=system type=fact The user plans to visit Italy next year, including\n", - " [462c0b89...] [fact_bf6...] role=system type=fact The user loves wine, especially Chianti and Brunel\n", - " [462c0b89...] [summary_...] role=system type=summary The user discussed plans to visit Italy next year,\n", - " [82849ac6...] [56c4c3c3...] role=user type=turn What's the best way to deploy a Python FastAPI app\n", - " [82849ac6...] [24cf1624...] role=agent type=turn Azure Container Apps is a great fit for FastAPI.\n", - " [82849ac6...] [99893621...] role=user type=turn Cool. I'm a Python engineer building AI tooling.\n", - " [82849ac6...] [7ea3e0ac...] role=agent type=turn Azure has excellent AI services — AI Foundry, AI S\n", - " [82849ac6...] [fact_dad...] role=system type=fact The user is a Python engineer building AI tooling.\n", - " [__user_s...] [user_sum...] role=system type=user_summary The user is a Python engineer.; The user is buildi\n", - " [82849ac6...] [summary_...] role=system type=summary The user asked about the best way to deploy a Pyth\n", - " [de98eb46...] [summary_...] role=system type=summary The user discussed building a hybrid recommendatio\n", - " [de98eb46...] [fact_5e8...] role=system type=fact The user is building a recommendation engine for a\n", - " [de98eb46...] [fact_c9e...] role=system type=fact The user chose a hybrid recommendation approach us\n", - " [de98eb46...] [fact_f77...] role=system type=fact The user prefers Python and plans to use FastAPI f\n", - " [de98eb46...] [ep_3a65f...] role=system type=episodic Last quarter, the user implemented a recommendatio\n", - " [de98eb46...] [fact_3a9...] role=system type=fact The user plans to implement a hybrid recommendatio\n", - " [de98eb46...] [fact_9d1...] role=system type=fact The user intends to use embeddings on book descrip\n", - " [e9d75005...] [c3b41618...] role=user type=turn I love hiking in the Pacific Northwest\n", - " [e9d75005...] [831c50e2...] role=agent type=turn The PNW has amazing trails like the Wonderland Tra\n", - " [de98eb46...] [fact_a37...] role=system type=fact The user prefers Python for development.\n", - " [de98eb46...] [fact_15f...] role=system type=fact The user wants to use FastAPI for the API layer of\n", - " [de98eb46...] [ep_53f68...] role=system type=episodic Last quarter, the user implemented a similar recom\n", - " [e9d75005...] [88803076...] role=user type=fact My favorite food is sushi, especially salmon nigir\n", - " [e9d75005...] [820486f6...] role=user type=turn I usually run 5 miles every morning before work\n", - " [e9d75005...] [3e754348...] role=agent type=turn Running is a great way to stay fit! Do you prefer \n", - " [e9d75005...] [d983c7e3...] role=user type=fact I work as a software engineer at a startup in Seat\n", - " [e9d75005...] [a001039f...] role=user type=fact My preferred programming language is Python\n", - " [e9d75005...] [2d8ad427...] role=agent type=turn Python is very popular for AI/ML workloads. What f\n", - " [75d8811b...] [b6b19602...] role=user type=turn Hi! I'm planning a trip to Tokyo next month.\n", - " [75d8811b...] [f792c4e7...] role=agent type=turn That sounds exciting! Tokyo is wonderful in spring\n", - " [75d8811b...] [17ccb199...] role=user type=turn I'd love food recommendations. I'm vegetarian.\n", - " [75d8811b...] [8a41f22a...] role=agent type=turn Great choice! Try Ain Soph in Shinjuku for plant-b\n", - " [75d8811b...] [532d93ee...] role=user type=turn Also, what's the best way to get around the city?\n", - " [75d8811b...] [20f5c5de...] role=agent type=turn A Suica or Pasmo IC card is the easiest option. It\n", - " [e8f0a465...] [a630e370...] role=user type=turn I've been having trouble sleeping lately. Any tips\n", - " [e8f0a465...] [efcc37f1...] role=agent type=turn Keep a consistent sleep schedule, avoid screens 1 \n", - " [e8f0a465...] [bcd60808...] role=user type=turn Does caffeine really affect sleep that much?\n", - " [e8f0a465...] [d1569024...] role=agent type=turn Yes — caffeine has a half-life of about 5-6 hours,\n", - " [e9d75005...] [summary_...] role=system type=summary The user shared personal background information in\n", - " [45853aeb...] [1cf925ed...] role=user type=turn Can you remind me of the Tokyo restaurant suggesti\n", - " [45853aeb...] [2094ee58...] role=agent type=turn Of course! Last time we discussed Ain Soph in Shin\n", - " [e9d75005...] [fact_fb7...] role=system type=fact The user loves hiking in the Pacific Northwest.\n", - " [e9d75005...] [fact_6ee...] role=system type=fact The user usually runs 5 miles every morning before\n", - " [ticket-9...] [ed75dc84...] role=user type=turn Hi, I'm having issues with my Surface Pro 9. The b\n", - " [ticket-9...] [6743a768...] role=agent type=turn I'm sorry to hear that. Could you share when you b\n", - " [ticket-9...] [090753e4...] role=user type=turn I bought it in March 2024 from the Microsoft Store\n", - " [ticket-9...] [5cf00dc0...] role=agent type=turn Thanks. I'll check warranty status. Could you also\n", - " [ticket-9...] [4fba41de...] role=user type=turn It's alex.chen@example.com. The order number was M\n", - " [ticket-9...] [3aec4d8c...] role=agent type=turn Verified — the device is under warranty. I've init\n", - " [ticket-9...] [3f14a39f...] role=user type=turn OK, will do. By the way, I work as a software engi\n", - " [e8f0a465...] [summary_...] role=system type=summary The user asked for help with recent sleep difficul\n", - " [75d8811b...] [fact_74b...] role=system type=fact The user is planning a trip to Tokyo next month.\n", - " [75d8811b...] [fact_858...] role=system type=fact The user follows a vegetarian diet.\n", - " [e8f0a465...] [fact_e49...] role=system type=fact The user has been having trouble sleeping lately.\n", - " [75d8811b...] [summary_...] role=system type=summary The user discussed plans for a trip to Tokyo next \n", - " [__user_s...] [user_sum...] role=system type=user_summary The user is planning a trip to Tokyo next month (m\n", - " [ticket-9...] [summary_...] role=system type=summary The user reported that their Surface Pro 9 battery\n", - " [ticket-9...] [fact_5d4...] role=system type=fact The user owns a Surface Pro 9 with a battery that \n", - " [ticket-9...] [fact_d40...] role=system type=fact The user purchased the Surface Pro 9 in March 2024\n", - " [ticket-9...] [fact_dfd...] role=system type=fact The user's email address is alex.chen@example.com.\n", - " [ticket-9...] [fact_d88...] role=system type=fact The order number for the Surface Pro 9 purchase is\n", - " [ticket-9...] [fact_b5d...] role=system type=fact The user's Surface Pro 9 is currently under warran\n", - " [ticket-9...] [fact_d3e...] role=system type=fact The user works as a software engineer and relies o\n", - " [ticket-9...] [fact_b88...] role=system type=fact The user agreed to run the Surface app diagnostic \n", - " [ticket-9...] [fact_772...] role=system type=fact The contact email associated with the Surface Pro \n", - " [ticket-9...] [fact_4e4...] role=system type=fact The user owns a Surface Pro 9 that currently exper\n", - " [ticket-9...] [fact_ac3...] role=system type=fact The order number for the user's Surface Pro 9 purc\n", - " [ticket-f...] [e1f26087...] role=user type=turn Hello again — Alex from the previous battery ticke\n", - " [ticket-f...] [5d5a3234...] role=agent type=turn Welcome back, Alex! Yes, that confirms the diagnos\n", - " [ticket-f...] [65e5092f...] role=user type=turn Great. While we're talking, can you recommend a US\n", - " [ticket-f...] [e2aff8e0...] role=agent type=turn The Surface Dock 2 or the Anker 778 are excellent \n", - " [ticket-f...] [28bd61e6...] role=user type=turn Multi-monitor is exactly what I need — I run 3 dis\n", - " [ticket-f...] [summary_...] role=system type=summary Alex reported a degraded battery on a Surface Pro \n", - " [ticket-f...] [fact_165...] role=system type=fact The Surface app diagnostic reported that the user'\n", - " [ticket-f...] [fact_9cf...] role=system type=fact A replacement battery service unit will be shipped\n", - " [ticket-f...] [fact_343...] role=system type=fact The user requires a USB-C dock compatible with the\n", - " [__user_s...] [user_sum...] role=system type=user_summary The user's name is Alex Chen.; The user's email ad\n", - " [ticket-f...] [fact_d81...] role=system type=fact The Surface app diagnostic reports that the user's\n", - " [ticket-f...] [fact_6ba...] role=system type=fact The user needs a USB-C dock compatible with the Su\n", - " [ticket-f...] [fact_8af...] role=system type=fact The user runs three displays for development work.\n", - " [ticket-f...] [ep_802fc...] role=system type=episodic The user's Surface Pro 9 was experiencing rapid ba\n", - " [ticket-b...] [4fea4556...] role=user type=turn Hi, I have a quick question about my Microsoft 365\n", - " [ticket-b...] [c8451dd2...] role=agent type=turn Welcome back, Alex! Happy to help with your Micros\n", - " [84350066...] [fbf439c3...] role=user type=turn Compare the environmental impact of electric vehic\n", - " [84350066...] [cc6e41cf...] role=agent type=turn PLAN:\n", - " 1. Research manufacturing impact (battery \n", - " [84350066...] [c8a01395...] role=agent type=turn FINDING 1 — Manufacturing: EV battery production e\n", - " [84350066...] [9a5c4e1d...] role=agent type=turn FINDING 2 — Energy source: EVs charged on renewabl\n", - " [84350066...] [6b1206fd...] role=agent type=turn FINDING 3 — End-of-life: Li-ion battery recycling \n", - " [84350066...] [25903ff0...] role=agent type=turn RECOMMENDATION: For urban fleets, battery-electric\n", - " [thread-e...] [666e8ef8...] role=system type=fact User prefers Python over Java for backend work\n", - " [thread-e...] [dcecaffb...] role=system type=fact User is allergic to peanuts\n", - " [thread-e...] [e26acf75...] role=system type=fact User lives in Seattle, WA\n", - " [thread-e...] [7f5e185b...] role=system type=episodic Last Friday the user shipped a Cosmos-backed searc\n", - " [thread-e...] [0bee2a1f...] role=system type=episodic User attended PyCon 2024 in Pittsburgh\n", - " [thread-e...] [fb81b994...] role=system type=procedural When the user says 'deploy', run `azd up` and tail\n", - " [thread-e...] [ad19e9c8...] role=system type=procedural Always confirm before purging Cosmos containers\n", - " [84350066...] [summary_...] role=system type=summary The conversation analyzed the environmental impact\n", - " [4c99b9ba...] [c1dffbb4...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [4c99b9ba...] [d1d42c19...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [4c99b9ba...] [6587d05b...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [4c99b9ba...] [477bfcf3...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [4c99b9ba...] [f133d14c...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [73810c6b...] [6a262048...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [73810c6b...] [4a24bc5a...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [73810c6b...] [752b35cc...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [73810c6b...] [6037ae5b...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [73810c6b...] [fact_8c6...] role=system type=fact The user loves Italian food.\n", - " [73810c6b...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [4c99b9ba...] [summary_...] role=system type=summary The user inquired about the weather in Seattle for\n", - " [2b2d0c38...] [995608e2...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [2b2d0c38...] [c9765c5e...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [2b2d0c38...] [00e02473...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [2b2d0c38...] [summary_...] role=system type=summary The user sent three consecutive test messages aski\n", - " [34249f73...] [eb3f86b6...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [34249f73...] [81d468be...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [34249f73...] [d9fd8db5...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [34249f73...] [c00391d0...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [34249f73...] [71a3704f...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [eb1efd30...] [29e6e76e...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [eb1efd30...] [d943c1a2...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [eb1efd30...] [a7cb61d7...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [eb1efd30...] [fbf6a5a9...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [eb1efd30...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [34249f73...] [summary_...] role=system type=summary The user inquired about the weather in Seattle for\n", - " [3283e3ce...] [ep_e85c2...] role=system type=episodic The user was planning a weekend trip to Seattle an\n", - " [a55e80a2...] [91c849c4...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [a55e80a2...] [1c317519...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [a55e80a2...] [e8aef776...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [a55e80a2...] [summary_...] role=system type=summary The user sent three consecutive messages requestin\n", - " [ae1eb483...] [3241461e...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [ae1eb483...] [a2d755ba...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ae1eb483...] [3fee9eaa...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [ae1eb483...] [1eabf113...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [ae1eb483...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [3283e3ce...] [ep_3c6fb...] role=system type=episodic The user planned a weekend trip to Seattle and req\n", - " [da6adb20...] [fact_e99...] role=system type=fact The user took a trip to Japan during cherry blosso\n", - " [__proced...] [proc_d2c...] role=system type=procedural When discussing deployment, always check the resou\n", - " [05c82d43...] [summary_...] role=system type=summary The conversation was about the user’s interest in \n", - " [05c82d43...] [fact_5b6...] role=system type=fact The user loves Italian cooking, especially pasta.\n", - " [05c82d43...] [fact_9bf...] role=system type=fact The user makes homemade fettuccine every weekend.\n", - " [f34d2765...] [summary_...] role=system type=summary The conversation was about the user’s daily runnin\n", - " [f34d2765...] [fact_cee...] role=system type=fact The user runs approximately 5 kilometres each day.\n", - " [151e417e...] [667d1b16...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [151e417e...] [00f1ec4f...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [151e417e...] [a49ad927...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [151e417e...] [a5a39119...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [151e417e...] [374d57e5...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [75b607c1...] [f2156f30...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [75b607c1...] [18d7b346...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [75b607c1...] [f5ec5d91...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [75b607c1...] [22c624a7...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [75b607c1...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [151e417e...] [summary_...] role=system type=summary The user inquired about the weather in Seattle for\n", - " [b09413cf...] [ff54043b...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [b09413cf...] [b97e629e...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [b09413cf...] [d99569a7...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [b09413cf...] [summary_...] role=system type=summary The user submitted three consecutive test messages\n", - " [18ec5623...] [48c350cb...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [18ec5623...] [20ddefe7...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [18ec5623...] [17a3e670...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [18ec5623...] [963a36a6...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [18ec5623...] [d53dad25...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [6514d03a...] [a6a9534e...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [6514d03a...] [2fbee9d5...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [6514d03a...] [6d1d2965...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [6514d03a...] [08f3076a...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [6514d03a...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [18ec5623...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [8c19d9fd...] [44bd3992...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [8c19d9fd...] [5bf99e0c...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [8c19d9fd...] [72485888...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [8c19d9fd...] [summary_...] role=system type=summary The user posted three consecutive test messages as\n", - " [thread-0...] [2b72e0ee...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [1f6ffd63...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [95ed7676...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [3a203195...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [3f725325...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [a92f4b54...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-0...] [9f3e86e1...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [6370552e...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [97b7e174...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [e38ecbee...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [70962375...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [72ddcc06...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-5...] [609929f8...] role=user type=turn I'm planning a hiking trip to Olympic National Par\n", - " [thread-5...] [c3c713fa...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-5...] [39d808cf...] role=user type=turn I'd like to camp 2 nights. Any permit guidance?\n", - " [thread-5...] [c7364e90...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-5...] [f5b81eba...] role=user type=turn Thanks — also, I'm vegetarian, please remember tha\n", - " [thread-3...] [8db09cea...] role=user type=turn I'm planning a hiking trip to Olympic National Par\n", - " [thread-3...] [c527bd97...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-3...] [70722057...] role=user type=turn I'd like to camp 2 nights. Any permit guidance?\n", - " [thread-3...] [7371ee6c...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-3...] [c405fc0b...] role=user type=turn Thanks — also, I'm vegetarian, please remember tha\n", - " [thread-0...] [d0e5e3c0...] role=user type=turn Hi! I love Cosmos DB.\n", - " [thread-0...] [95d62050...] role=agent type=turn Cosmos DB is fantastic for low-latency global apps\n", - " [thread-0...] [d5a09f4a...] role=user type=turn Can it do vector search?\n", - " [thread-0...] [be0085d4...] role=agent type=turn Yes — DiskANN indexes power semantic search native\n", - " [thread-0...] [cc7d040a...] role=user type=turn Great. What about hierarchical partition keys?\n", - " [thread-0...] [c09230e7...] role=agent type=turn HPK lets you co-locate related items for efficient\n", - " [thread-c...] [61bff06f...] role=user type=turn I'm planning a hiking trip to Olympic National Par\n", - " [thread-c...] [3582eb74...] role=agent type=turn Great choice! Hoh Rainforest and Hurricane Ridge a\n", - " [thread-c...] [8133e553...] role=user type=turn I'd like to camp 2 nights. Any permit guidance?\n", - " [thread-c...] [598dff39...] role=agent type=turn You'll need a wilderness permit from recreation.go\n", - " [thread-c...] [4bb7b2c4...] role=user type=turn Thanks — also, I'm vegetarian, please remember tha\n", - " [thread-c...] [summary_...] role=system type=summary The user discussed planning a hiking and camping t\n", - " [2dec0199...] [492d9dbb...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [2dec0199...] [d53348b1...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [2dec0199...] [048b347d...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [2dec0199...] [f170341e...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [2dec0199...] [f3b2e998...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [97d1c7d2...] [b34510a1...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [97d1c7d2...] [45d6f3eb...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [97d1c7d2...] [d57ed8f9...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [97d1c7d2...] [61ec5e9b...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [2dec0199...] [summary_...] role=system type=summary The user inquired about the weather in Seattle for\n", - " [97d1c7d2...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [437580e8...] [1eefde64...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [437580e8...] [741b0b83...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [437580e8...] [41fcd871...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [437580e8...] [ebb06dba...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [437580e8...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [3283e3ce...] [ep_c489a...] role=system type=episodic The user was planning a weekend trip to Seattle an\n", - " [f6e63541...] [43830249...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [f6e63541...] [9c052937...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [f6e63541...] [8b2c0b88...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [f6e63541...] [summary_...] role=system type=summary The user sent three consecutive test messages requ\n", - " [9ed6e905...] [10da44e8...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [9ed6e905...] [f200bbc0...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [9ed6e905...] [59877c89...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [9ed6e905...] [30b9b34f...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [9ed6e905...] [9a2a651c...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [9ed6e905...] [d7f74720...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [9ed6e905...] [bfb488e8...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [9ed6e905...] [1498a6b1...] role=user type=turn Also, if a round-trip flight ever costs more than \n", - " [9ed6e905...] [0d216b3d...] role=agent type=turn Understood — I'll confirm with you before booking \n", - " [9ed6e905...] [5123cac9...] role=user type=turn One more thing: when picking a hotel, always check\n", - " [9ed6e905...] [c9b3d5ab...] role=agent type=turn Will do. I'll filter hotel suggestions to only tho\n", - " [ede78157...] [6f6aec0d...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [ede78157...] [d89aa694...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ede78157...] [2bd4f216...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [ede78157...] [bda83ce2...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [ede78157...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [9ed6e905...] [summary_...] role=system type=summary The conversation focused on planning a weekend tri\n", - " [__proced...] [proc_931...] role=system type=procedural Always select an aisle seat when booking flights f\n", - " [__proced...] [proc_bb3...] role=system type=procedural If a round-trip flight costs more than $300, stop \n", - " [__proced...] [proc_d15...] role=system type=procedural Always verify that breakfast is included before re\n", - " [c627fc8c...] [3a23f2c1...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [c627fc8c...] [3fb6ea61...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [c627fc8c...] [166d689f...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [c627fc8c...] [summary_...] role=system type=summary The user sent three consecutive messages asking fo\n", - " [e2422aed...] [0cc39f4a...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [e2422aed...] [a5c17037...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [e2422aed...] [d2d28ce4...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [e2422aed...] [bed9110b...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [e2422aed...] [a0ebc75c...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [e2422aed...] [a07d551b...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [e2422aed...] [85416876...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [e2422aed...] [602974a7...] role=user type=turn One more thing: when picking a hotel, always check\n", - " [e2422aed...] [a5595e14...] role=user type=turn Also, if a round-trip flight ever costs more than \n", - " [e2422aed...] [fac38202...] role=agent type=turn Will do. I'll filter hotel suggestions to only tho\n", - " [e2422aed...] [01b514c0...] role=agent type=turn Understood — I'll confirm with you before booking \n", - " [ba2753c5...] [e5242b96...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [ba2753c5...] [f62c3be1...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ba2753c5...] [256f126e...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [ba2753c5...] [5f541c2a...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [ba2753c5...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [e2422aed...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [3283e3ce...] [ep_69c22...] role=system type=episodic The user planned a weekend trip to Seattle and req\n", - " [e761b38f...] [644b1c65...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [e761b38f...] [187cb97b...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [e761b38f...] [1a4868c7...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [e761b38f...] [summary_...] role=system type=summary The user repeatedly requested information about ve\n", - " [d3a73355...] [07408ee7...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [d3a73355...] [7fc1a400...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [d3a73355...] [a895d314...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [d3a73355...] [64d95944...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [d3a73355...] [05901836...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [d3a73355...] [f0588b81...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [d3a73355...] [a762cd26...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [d3a73355...] [fb3b29cb...] role=user type=turn Also, if a round-trip flight ever costs more than \n", - " [d3a73355...] [81ce6316...] role=agent type=turn Understood — I'll confirm with you before booking \n", - " [d3a73355...] [b7132ab4...] role=user type=turn One more thing: when picking a hotel, always check\n", - " [d3a73355...] [86a404c9...] role=agent type=turn Will do. I'll filter hotel suggestions to only tho\n", - " [e9ed3070...] [cd7f6b1e...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [e9ed3070...] [9cf12919...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [e9ed3070...] [fe00ba5d...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [e9ed3070...] [8712d011...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [e9ed3070...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [d3a73355...] [summary_...] role=system type=summary The conversation centered on planning a weekend tr\n", - " [62a3a5c8...] [aa370d97...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [62a3a5c8...] [14ab61c9...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [62a3a5c8...] [26ee5819...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [62a3a5c8...] [summary_...] role=system type=summary The user sent three consecutive messages asking fo\n", - " [92fcfce7...] [8db42544...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [92fcfce7...] [9b497f45...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [92fcfce7...] [2ac1f955...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [92fcfce7...] [9e72adc1...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [92fcfce7...] [340d4e33...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [92fcfce7...] [1eb0d2c3...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [92fcfce7...] [3a3d1544...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [92fcfce7...] [60277430...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [92fcfce7...] [ba8c8d52...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [92fcfce7...] [d9b1592b...] role=user type=turn And never book me into anything that departs or ar\n", - " [92fcfce7...] [2485f06d...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [26392a45...] [793c6f84...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [26392a45...] [41f1ba4d...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [26392a45...] [3fd7590b...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [26392a45...] [54cf4894...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [26392a45...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [__proced...] [proc_62f...] role=system type=procedural When planning a trip for the user, first check the\n", - " [__proced...] [proc_b28...] role=system type=procedural Never book flights that depart or arrive between m\n", - " [92fcfce7...] [summary_...] role=system type=summary The conversation focused on planning a weekend tri\n", - " [3a9921f9...] [7ca8f672...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [3a9921f9...] [b081cfa7...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [3a9921f9...] [b2f71697...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [3a9921f9...] [summary_...] role=system type=summary The user repeatedly asked for information about ve\n", - " [f0fd9a78...] [bc85dd29...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [f0fd9a78...] [7df1661f...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [f0fd9a78...] [1f84e8ac...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [f0fd9a78...] [62abba0b...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [f0fd9a78...] [034bd98c...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [f0fd9a78...] [77ac6f91...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [f0fd9a78...] [9bc141ef...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [f0fd9a78...] [a9d6ffc0...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [f0fd9a78...] [51227197...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [f0fd9a78...] [043fc770...] role=user type=turn And never book me into anything that departs or ar\n", - " [f0fd9a78...] [f6cd2184...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [5c3287a4...] [3e7d7dd6...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [5c3287a4...] [5955e0e9...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [5c3287a4...] [f45c05b0...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [5c3287a4...] [9866371e...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [5c3287a4...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [f0fd9a78...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [2f517f40...] [468248fe...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [2f517f40...] [13be98ec...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [2f517f40...] [46cd74c8...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [2f517f40...] [summary_...] role=system type=summary The user sent three identical test messages asking\n", - " [b48abfd4...] [220e3777...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [b48abfd4...] [04627b70...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [b48abfd4...] [8cd6cac1...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [b48abfd4...] [01c33d7d...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [b48abfd4...] [b022017e...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [b48abfd4...] [6a317eda...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [b48abfd4...] [83a30869...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [b48abfd4...] [f8df8e80...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [b48abfd4...] [1d2f503d...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [b48abfd4...] [d363effd...] role=user type=turn And never book me into anything that departs or ar\n", - " [b48abfd4...] [a087dfa4...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [dbdc90d0...] [1b4a20d8...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [dbdc90d0...] [8aaead6f...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [dbdc90d0...] [83df810c...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [dbdc90d0...] [e2e684e6...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [dbdc90d0...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [b48abfd4...] [summary_...] role=system type=summary The conversation focused on planning a weekend tri\n", - " [8adaad5f...] [614a52a8...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [8adaad5f...] [628b5e82...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [8adaad5f...] [f05774e7...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [8adaad5f...] [summary_...] role=system type=summary The user repeatedly requested information about ve\n", - " [a1210ca7...] [8f8c0453...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [a1210ca7...] [8486acee...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [a1210ca7...] [1329afa7...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [a1210ca7...] [210b1234...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [a1210ca7...] [0712700a...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [a1210ca7...] [33dfad55...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [a1210ca7...] [3a6887c4...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [a1210ca7...] [a9a357fb...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [a1210ca7...] [9c18002a...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [a1210ca7...] [8bc59512...] role=user type=turn And never book me into anything that departs or ar\n", - " [a1210ca7...] [7835ebd2...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [e97abcfc...] [86bbc4ef...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [e97abcfc...] [c40acde3...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [e97abcfc...] [bcab2b5c...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [e97abcfc...] [25890ac3...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [e97abcfc...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [a1210ca7...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [a1210ca7...] [fact_ccc...] role=system type=fact The user requires round-trip flights to cost under\n", - " [__proced...] [proc_408...] role=system type=procedural Always select an aisle seat when booking flights f\n", - " [__proced...] [proc_6da...] role=system type=procedural Follow this order for trip planning: first check t\n", - " [__proced...] [proc_778...] role=system type=procedural Never book flights that depart or arrive between m\n", - " [__user_s...] [user_sum...] role=system type=user_summary For the planned Seattle weekend trip, the user set\n", - " [a1210ca7...] [fact_e7b...] role=system type=fact The user prefers to stay near Pike Place Market wh\n", - " [__proced...] [proc_056...] role=system type=procedural Always book an aisle seat when reserving flights f\n", - " [__proced...] [proc_074...] role=system type=procedural Follow the trip planning order: first check the we\n", - " [__proced...] [proc_b50...] role=system type=procedural Never book travel that departs or arrives between \n", - " [ee162c4e...] [15dd4113...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [ee162c4e...] [b6abc60f...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [ee162c4e...] [70dd5fba...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [a1210ca7...] [fact_44d...] role=system type=fact The user requires hotel stays to cost under $200 p\n", - " [ee162c4e...] [summary_...] role=system type=summary The user repeatedly asked for information about ve\n", - " [8f82e8c2...] [5431ec91...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [8f82e8c2...] [86395b5c...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [8f82e8c2...] [f810ee90...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [8f82e8c2...] [adf43f71...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [8f82e8c2...] [2c53284f...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [8f82e8c2...] [824b7d06...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [8f82e8c2...] [03f4f090...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [8f82e8c2...] [4e39a623...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [8f82e8c2...] [e61823c0...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [8f82e8c2...] [011604c6...] role=user type=turn And never book me into anything that departs or ar\n", - " [8f82e8c2...] [de44f072...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [925c1a31...] [dd1a62f4...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [925c1a31...] [1bc3a721...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [925c1a31...] [d334b9f8...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [925c1a31...] [81c4308b...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [925c1a31...] [03e66bf9...] role=user type=turn Never book me into anything that departs or arrive\n", - " [925c1a31...] [bbbce8be...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [925c1a31...] [6ad6dcd7...] role=user type=turn When picking a hotel, only recommend ones that inc\n", - " [925c1a31...] [490aeb85...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [1aba6dfb...] [94d40c8a...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [1aba6dfb...] [67c9d6d2...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [1aba6dfb...] [d808c78f...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [1aba6dfb...] [f973d01f...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [925c1a31...] [summary_...] role=system type=summary The user established standing travel preferences a\n", - " [__proced...] [proc_433...] role=system type=procedural Always book an aisle seat and never select a windo\n", - " [__proced...] [proc_938...] role=system type=procedural For trip planning, first check the weather for the\n", - " [__proced...] [proc_ada...] role=system type=procedural Never book travel that departs or arrives between \n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [__proced...] [proc_3c1...] role=system type=procedural Always book an aisle seat and never select a windo\n", - " [__proced...] [proc_2bf...] role=system type=procedural First check the weather, then check flights, and b\n", - " [8f82e8c2...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [1aba6dfb...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [__proced...] [proc_4ac...] role=system type=procedural Only recommend hotels that include complimentary b\n", - " [8f82e8c2...] [fact_1fd...] role=system type=fact For the Seattle weekend trip, the user requires ro\n", - " [8f82e8c2...] [fact_b62...] role=system type=fact For the Seattle weekend trip, the user requires ho\n", - " [8f82e8c2...] [fact_555...] role=system type=fact For the Seattle weekend trip, the user prefers hot\n", - " [8f82e8c2...] [fact_5b6...] role=system type=fact No flight or hotel reservations were finalized for\n", - " [4c829316...] [d5b082ea...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [4c829316...] [1a0a7275...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [4c829316...] [85d26801...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [4c829316...] [summary_...] role=system type=summary The user sent three consecutive test messages aski\n", - " [df2c66e2...] [a95f36c7...] role=user type=turn And never book me into anything that departs or ar\n", - " [df2c66e2...] [885e20a1...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [df2c66e2...] [86f7ffdf...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [df2c66e2...] [a14e680c...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [df2c66e2...] [291b33d2...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [df2c66e2...] [8ac8ad2d...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [df2c66e2...] [c506e7b2...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [df2c66e2...] [0085b70d...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [ae1bb147...] [044f536b...] role=user type=turn Never book me into anything that departs or arrive\n", - " [ae1bb147...] [49f590c9...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [ae1bb147...] [3863b2a1...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [ae1bb147...] [e5a7e19f...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [ae1bb147...] [36fc3840...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [df2c66e2...] [d2b63415...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [df2c66e2...] [293d9579...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [ae1bb147...] [6d68214d...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [ae1bb147...] [88479523...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [df2c66e2...] [44f1c083...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [ae1bb147...] [fffe6fde...] role=user type=turn When picking a hotel, only recommend ones that inc\n", - " [85e74267...] [7cfd003e...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [85e74267...] [32b3911a...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [85e74267...] [046fc368...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [85e74267...] [2594fb41...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [85e74267...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [__proced...] [proc_b00...] role=system type=procedural Always book an aisle seat and never select a windo\n", - " [ae1bb147...] [summary_...] role=system type=summary The user established standing travel booking prefe\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [__proced...] [proc_4b0...] role=system type=procedural First check the weather, then check flights, and b\n", - " [__proced...] [proc_53a...] role=system type=procedural Never book travel that departs or arrives between \n", - " [__proced...] [proc_eef...] role=system type=procedural Only recommend hotels that include complimentary b\n", - " [df2c66e2...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [df2c66e2...] [fact_f5d...] role=system type=fact For the Seattle trip, the user requires round-trip\n", - " [df2c66e2...] [fact_a7d...] role=system type=fact For the Seattle trip, the user requires hotel rate\n", - " [df2c66e2...] [fact_53c...] role=system type=fact For the Seattle trip, the user prefers hotels loca\n", - " [__proced...] [proc_ef1...] role=system type=procedural Always book an aisle seat when reserving flights f\n", - " [__proced...] [proc_286...] role=system type=procedural When planning a trip, first check the weather for \n", - " [__proced...] [proc_9a3...] role=system type=procedural Never book flights that depart or arrive between m\n", - " [1a2686a2...] [72643b0a...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [1a2686a2...] [653a328a...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [1a2686a2...] [0ce72055...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [1a2686a2...] [36f4abfe...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [1a2686a2...] [62e4971c...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [1a2686a2...] [c91a8397...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [1a2686a2...] [b0f0f031...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [1a2686a2...] [de786284...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [1a2686a2...] [863a0e92...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [1a2686a2...] [440b3ccd...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [1a2686a2...] [6c71c103...] role=user type=turn And never book me into anything that departs or ar\n", - " [6c5e0b18...] [9d94e048...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [6c5e0b18...] [a9ca1c0c...] role=user type=turn Never book me into anything that departs or arrive\n", - " [6c5e0b18...] [b8d706b5...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [6c5e0b18...] [8079f2a5...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [6c5e0b18...] [6ec3f38c...] role=user type=turn When picking a hotel, only recommend ones that inc\n", - " [6c5e0b18...] [b3cac85c...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [6c5e0b18...] [bce69f91...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [6c5e0b18...] [096d24da...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [ac8cf2db...] [3b3f7880...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [ac8cf2db...] [e388f6c6...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [ac8cf2db...] [47cf2489...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [ac8cf2db...] [ad4aa222...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [ac8cf2db...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [__proced...] [proc_372...] role=system type=procedural Always book an aisle seat and never select a windo\n", - " [__proced...] [proc_5c8...] role=system type=procedural Follow this order for trip planning: first check t\n", - " [__proced...] [proc_9f3...] role=system type=procedural Never book flights that depart or arrive between m\n", - " [__proced...] [proc_eb7...] role=system type=procedural Only recommend hotels that include complimentary b\n", - " [6c5e0b18...] [summary_...] role=system type=summary The user established persistent travel booking pre\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [1a2686a2...] [fact_f0a...] role=system type=fact The user prefers hotels located near Pike Place Ma\n", - " [1a2686a2...] [fact_67a...] role=system type=fact The user requires round-trip flights to cost under\n", - " [1a2686a2...] [summary_...] role=system type=summary The conversation focused on planning a weekend tri\n", - " [1a2686a2...] [fact_92f...] role=system type=fact The user requires hotels to cost under $200 per ni\n", - " [__proced...] [proc_d23...] role=system type=procedural Always book an aisle seat when reserving flights f\n", - " [__proced...] [proc_210...] role=system type=procedural For trip planning, first check the destination wea\n", - " [__proced...] [proc_afd...] role=system type=procedural Never book travel that departs or arrives between \n", - " [30387fc9...] [d0e2a4c7...] role=user type=turn Change feed test message 1: Tell me about vector d\n", - " [30387fc9...] [e81a71eb...] role=user type=turn Change feed test message 2: Tell me about vector d\n", - " [30387fc9...] [3b386db9...] role=user type=turn Change feed test message 3: Tell me about vector d\n", - " [30387fc9...] [summary_...] role=system type=summary The user repeatedly asked for information about ve\n", - " [0df5b6dc...] [f79fbed6...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [0df5b6dc...] [26681a8e...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [0df5b6dc...] [87fa4b2f...] role=user type=turn Can you book me a weekend trip there? Flights unde\n", - " [0df5b6dc...] [864f087a...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [0df5b6dc...] [7f1c2807...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [0df5b6dc...] [0cdaa994...] role=agent type=turn Got it — aisle seats only.\n", - " [0df5b6dc...] [6595962f...] role=user type=turn For trip planning, my workflow is: first weather, \n", - " [0df5b6dc...] [4f35ab5b...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [0df5b6dc...] [872bf1fb...] role=user type=turn Never book me into anything between midnight and 6\n", - " [0df5b6dc...] [ab9e45ba...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [0df5b6dc...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [bc4a98cb...] [16bb8e00...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [bc4a98cb...] [1076e63c...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [bc4a98cb...] [740137c4...] role=user type=turn Can you book me a weekend trip there? Flights unde\n", - " [bc4a98cb...] [6ba1d437...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [bc4a98cb...] [c97de899...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [bc4a98cb...] [fcf81c7c...] role=agent type=turn Got it — aisle seats only.\n", - " [bc4a98cb...] [059c3307...] role=user type=turn For trip planning, my workflow is: first weather, \n", - " [bc4a98cb...] [45e487f4...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [bc4a98cb...] [0a31dba0...] role=user type=turn Never book me into anything between midnight and 6\n", - " [bc4a98cb...] [1c81ae44...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [0df5b6dc...] [fact_f54...] role=system type=fact The user requires flights to cost under $300 when \n", - " [0df5b6dc...] [fact_cd2...] role=system type=fact The user requires hotels to cost under $200 per ni\n", - " [__proced...] [proc_de5...] role=system type=procedural Always book an aisle seat and never select a windo\n", - " [__proced...] [proc_7d7...] role=system type=procedural Follow the sequence weather → flights → hotel when\n", - " [__proced...] [proc_4d7...] role=system type=procedural Never book flights or accommodations scheduled bet\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [bc4a98cb...] [summary_...] role=system type=summary The user inquired about the weather in Seattle for\n", - " [bc4a98cb...] [fact_008...] role=system type=fact The user prefers aisle seats and does not want win\n", - " [__proced...] [proc_4b6...] role=system type=procedural Always book an aisle seat and never select a windo\n", - " [__proced...] [proc_781...] role=system type=procedural Follow the trip planning sequence: first check wea\n", - " [bc4a98cb...] [fact_84c...] role=system type=fact The user requires flights to cost under $300 and h\n", - " [__proced...] [proc_861...] role=system type=procedural Always book an aisle seat when booking flights for\n", - " [__proced...] [proc_fc7...] role=system type=procedural Follow the sequence weather → flights → hotel when\n", - " [__proced...] [proc_f86...] role=system type=procedural Never book any flights, hotels, or other travel ar\n", - " [bc4a98cb...] [fact_ef8...] role=system type=fact The user requires flights to cost under $300 when \n", - " [bc4a98cb...] [fact_48a...] role=system type=fact The user requires hotels to cost under $200 per ni\n", - " [__proced...] [proc_7a9...] role=system type=procedural Always book an aisle seat when reserving flights f\n", - " [__proced...] [proc_f7a...] role=system type=procedural Never book any travel or reservations between midn\n", - " [bdd72079...] [c35421d5...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [bdd72079...] [9a99982d...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [bdd72079...] [23949c83...] role=user type=turn Can you book me a weekend trip there? Flights unde\n", - " [bdd72079...] [f17db44a...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [bdd72079...] [037bdee7...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [bdd72079...] [804c1f25...] role=agent type=turn Got it — aisle seats only.\n", - " [bdd72079...] [c8b3bc80...] role=user type=turn For trip planning, my workflow is: first weather, \n", - " [bdd72079...] [56d4e04b...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [bdd72079...] [3ba30ca4...] role=user type=turn Never book me into anything between midnight and 6\n", - " [bdd72079...] [9857a10d...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [bdd72079...] [summary_...] role=system type=summary The conversation centered on planning a potential \n", - " [bdd72079...] [fact_18e...] role=system type=fact The user requires flights under $300 and hotels un\n", - " [__proced...] [proc_352...] role=system type=procedural Always book an aisle seat when reserving flights f\n", - " [__proced...] [proc_df7...] role=system type=procedural Follow the sequence: check weather first, then boo\n", - " [__proced...] [proc_a79...] role=system type=procedural Never book flights, hotels, or other travel arrang\n", - " [42b91b2c...] [18d9c7c9...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [42b91b2c...] [aee54464...] role=agent type=turn Around 55°F with partly cloudy skies on Saturday a\n", - " [42b91b2c...] [eb65d898...] role=user type=turn Can you book me a weekend trip there? Flights unde\n", - " [42b91b2c...] [2610f0f2...] role=agent type=turn I found a $275 Alaska Airlines round-trip and a $1\n", - " [42b91b2c...] [a2c8f719...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [42b91b2c...] [81e4ae3f...] role=agent type=turn Got it — aisle seats only.\n", - " [42b91b2c...] [d8bb773e...] role=user type=turn For trip planning, my workflow is: first weather, \n", - " [42b91b2c...] [88c29041...] role=agent type=turn Noted — weather → flights → hotel.\n", - " [42b91b2c...] [e72a7a00...] role=user type=turn Never book me into anything between midnight and 6\n", - " [42b91b2c...] [aec0a2ba...] role=agent type=turn Understood — no overnight bookings without your ap\n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [42b91b2c...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [42b91b2c...] [fact_95d...] role=system type=fact The user requested booking a weekend trip to Seatt\n", - " [42b91b2c...] [fact_81e...] role=system type=fact The user requires flights to cost under $300 and h\n", - " [__proced...] [proc_d89...] role=system type=procedural Always book an aisle seat and never book a window \n", - " [__proced...] [proc_5ed...] role=system type=procedural Follow the sequence weather first, then flights, t\n", - " [__proced...] [proc_afb...] role=system type=procedural Never book flights or accommodations between midni\n", - " [e50f775e...] [3e4513c7...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [e50f775e...] [88a718fa...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [e50f775e...] [5d25077d...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [e50f775e...] [79dae6a8...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [e50f775e...] [4f8721a6...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [e50f775e...] [fb17aeea...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [e50f775e...] [3f00a18c...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [e50f775e...] [a8485c36...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [e50f775e...] [4d4926ec...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [e50f775e...] [4e597b6d...] role=user type=turn And never book me into anything that departs or ar\n", - " [e50f775e...] [96aa9017...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [8f42e1b5...] [d060a91b...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [8f42e1b5...] [26ba3a10...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [8f42e1b5...] [4efc2fe2...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [8f42e1b5...] [2430022a...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [8f42e1b5...] [61a8ac71...] role=user type=turn Never book me into anything that departs or arrive\n", - " [8f42e1b5...] [300757b0...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [8f42e1b5...] [1fe93ba3...] role=user type=turn When picking a hotel, only recommend ones that inc\n", - " [8f42e1b5...] [c997e440...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [7b8fc78b...] [0ad9d278...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [7b8fc78b...] [0e5d8a0a...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [7b8fc78b...] [ec1a3a5d...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [7b8fc78b...] [c0437ffe...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n", - " [8f42e1b5...] [summary_...] role=system type=summary The user established persistent travel booking pre\n", - " [7b8fc78b...] [summary_...] role=system type=summary The user asked for restaurant recommendations in N\n", - " [__proced...] [proc_afe...] role=system type=procedural Always book an aisle seat and never select a windo\n", - " [__proced...] [proc_c12...] role=system type=procedural Follow this order for trip planning: first check t\n", - " [__proced...] [proc_c6f...] role=system type=procedural Never book travel that departs or arrives between \n", - " [__user_s...] [user_sum...] role=system type=user_summary {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \n", - " [__proced...] [proc_9d5...] role=system type=procedural Only recommend hotels that include complimentary b\n", - " [e50f775e...] [summary_...] role=system type=summary The user inquired about a weekend trip to Seattle,\n", - " [e50f775e...] [fact_9e9...] role=system type=fact The user prefers hotels located near Pike Place Ma\n", - " [e50f775e...] [fact_2ad...] role=system type=fact The user requires round-trip flights to cost under\n", - " [e50f775e...] [fact_230...] role=system type=fact The user requires hotel rates to be under $200 per\n", - " [__proced...] [proc_dee...] role=system type=procedural Always book an aisle seat when reserving flights f\n", - " [807c3bc6...] [c6b6827e...] role=agent type=turn This weekend Seattle will be around 55°F with part\n", - " [807c3bc6...] [101560c2...] role=agent type=turn Sure! I found round-trip flights departing Friday \n", - " [807c3bc6...] [558654f4...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [c1138077...] [47eef782...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [c1138077...] [30da082b...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [c1138077...] [40665284...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [c1138077...] [c5d66e1a...] role=user type=turn Never book me into anything that departs or arrive\n", - " [807c3bc6...] [5544d374...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [807c3bc6...] [3ee542c4...] role=agent type=turn Got it. I'll always select an aisle seat for your \n", - " [807c3bc6...] [67cee94e...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 a\n", - " [807c3bc6...] [afe25494...] role=user type=turn Something near Pike Place Market would be great. K\n", - " [c1138077...] [2b7e104d...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [807c3bc6...] [bb55ae9b...] role=user type=turn Whenever you book a flight for me, always book an \n", - " [c1138077...] [4e5b3a7d...] role=agent type=turn Understood — only hotels with complimentary breakf\n", - " [c1138077...] [15f9f705...] role=user type=turn For trip planning, my workflow is: first check the\n", - " [807c3bc6...] [97401d13...] role=agent type=turn Will do — no overnight bookings without your expli\n", - " [807c3bc6...] [3a42a459...] role=agent type=turn Noted — I'll follow that order: weather, then flig\n", - " [807c3bc6...] [056e8fcb...] role=user type=turn And never book me into anything that departs or ar\n", - " [c1138077...] [705626cf...] role=user type=turn When picking a hotel, only recommend ones that inc\n", - " [6b59bbaf...] [cc399b5f...] role=user type=turn Can you recommend some good restaurants in New Yor\n", - " [6b59bbaf...] [6a66be86...] role=agent type=turn Absolutely! NYC has incredible dining options. For\n", - " [6b59bbaf...] [287c7246...] role=user type=turn I love Italian food. Are there any options that ar\n", - " [6b59bbaf...] [546aff6a...] role=agent type=turn For budget-friendly Italian in NYC, check out L'in\n" - ] - } - ], - "source": [ - "# Delete the tool memory from Cosmos (async)\n", - "tool_mems = await memory.get_memories(user_id=\"user-002\", role=\"tool\")\n", - "print(tool_mems[0])\n", - "if tool_mems:\n", - " await memory.delete_cosmos(\n", - " tool_mems[0][\"id\"],\n", - " thread_id=tool_mems[0][\"thread_id\"],\n", - " user_id=tool_mems[0][\"user_id\"],\n", - " )\n", - " print(f\"Deleted tool memory {tool_mems[0]['id'][:8]}...\")\n", - "\n", - "# Verify\n", - "remaining = await memory.get_memories()\n", - "print(f\"\\nRemaining memories in Cosmos DB: {len(remaining)}\")\n", - "for r in remaining:\n", - " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} type={r['type']:<8} {r['content'][:50]}\")" - ] - }, - { - "cell_type": "markdown", - "id": "007708d5", - "metadata": {}, - "source": [ - "### 3e. Retrieve a full thread with `get_thread`\n", - "\n", - "Same parameters: `thread_id` (required), `user_id` (optional), `recent_k` (optional)." - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "3ed613d3", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:07:40.340577Z", - "start_time": "2026-04-07T22:07:40.138825Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:25:50.014174Z", - "iopub.status.busy": "2026-05-04T20:25:50.014096Z", - "iopub.status.idle": "2026-05-04T20:25:50.246063Z", - "shell.execute_reply": "2026-05-04T20:25:50.245174Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Using thread_id: 807c3bc6-c021-4f66-b996-07bc5ef781ab\n", - "\n", - "All memories in thread: 11\n", - " [807c3bc6...] [558654f4...] role=user type=turn What's the weather like in Seattle this weekend?\n", - " [807c3bc6...] [c6b6827e...] role=agent type=turn This weekend Seattle will be around 55°F with partly cloudy \n", - " [807c3bc6...] [101560c2...] role=agent type=turn Sure! I found round-trip flights departing Friday evening an\n", - " [807c3bc6...] [afe25494...] role=user type=turn Something near Pike Place Market would be great. Keep flight\n", - " [807c3bc6...] [67cee94e...] role=agent type=turn I found a round-trip on Alaska Airlines for $275 and two hot\n", - " [807c3bc6...] [bb55ae9b...] role=user type=turn Whenever you book a flight for me, always book an aisle seat\n", - " [807c3bc6...] [3ee542c4...] role=agent type=turn Got it. I'll always select an aisle seat for your bookings.\n", - " [807c3bc6...] [5544d374...] role=user type=turn For trip planning, my workflow is: first check the weather f\n", - " [807c3bc6...] [3a42a459...] role=agent type=turn Noted — I'll follow that order: weather, then flights, then \n", - " [807c3bc6...] [056e8fcb...] role=user type=turn And never book me into anything that departs or arrives betw\n", - " [807c3bc6...] [97401d13...] role=agent type=turn Will do — no overnight bookings without your explicit approv\n", - "\n", - "Most recent 2 memories:\n", - " [807c3bc6...] [056e8fcb...] role=user type=turn And never book me into anything that departs or arrives betw\n", - " [807c3bc6...] [97401d13...] role=agent type=turn Will do — no overnight bookings without your explicit approv\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "Thread memories for user-ea5eba7a: 11\n" - ] - } - ], - "source": [ - "# Use the CURRENT seed thread (from cell 5) so we operate on the data we just wrote.\n", - "thread_id = THREAD_ID\n", - "print(f\"Using thread_id: {thread_id}\\n\")\n", - "\n", - "# Get all documents in the thread\n", - "thread_all = await memory.get_thread(thread_id=thread_id)\n", - "print(f\"All memories in thread: {len(thread_all)}\")\n", - "for m in thread_all:\n", - " print(f\" [{m['thread_id'][:8]}...] [{m['id'][:8]}...] role={m.get('role','?'):6} type={m['type']:8} {m['content'][:60]}\")\n", - "\n", - "recent = await memory.get_thread(thread_id=thread_id, recent_k=2)\n", - "print(f\"\\nMost recent 2 memories:\")\n", - "for m in recent:\n", - " print(f\" [{m['thread_id'][:8]}...] [{m['id'][:8]}...] role={m.get('role','?'):6} type={m['type']:8} {m['content'][:60]}\")\n", - "\n", - "thread_user = await memory.get_thread(thread_id=thread_id, user_id=USER_ID)\n", - "print(f\"\\nThread memories for {USER_ID}: {len(thread_user)}\")\n" - ] - }, - { - "cell_type": "markdown", - "id": "06a9f99d", - "metadata": {}, - "source": [ - "## 4. Thread Summary (in-process)\n", - "\n", - "`AsyncCosmosMemoryClient.generate_thread_summary()` runs the summarisation pipeline **in-process** — no Azure Functions required. The async client uses the AI Foundry async openai client and the async Cosmos SDK, so calls don't block the event loop.\n", - "\n", - "If a prior summary exists, the call performs an **incremental update** that preserves the metadata-tracked `source_count`.\n" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "9bc68919", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:08:08.478793Z", - "start_time": "2026-04-07T22:07:45.385054Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:25:50.247941Z", - "iopub.status.busy": "2026-05-04T20:25:50.247791Z", - "iopub.status.idle": "2026-05-04T20:26:03.871259Z", - "shell.execute_reply": "2026-05-04T20:26:03.870396Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Summarizing thread_id=807c3bc6-c021-4f66-b996-07bc5ef781ab user_id=user-ea5eba7a\n", - "\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "LLM model=gpt-5.2-chat rejected 'temperature'; retrying without it.\n" - ] - } - ], - "source": [ - "thread_id = THREAD_ID\n", - "user_id = USER_ID\n", - "print(f\"Summarizing thread_id={thread_id} user_id={user_id}\\n\")\n", - "\n", - "summary_doc = await memory.generate_thread_summary(user_id=user_id, thread_id=thread_id)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "da4cba4f", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:08:13.446032Z", - "start_time": "2026-04-07T22:08:13.390800Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:03.875835Z", - "iopub.status.busy": "2026-05-04T20:26:03.875663Z", - "iopub.status.idle": "2026-05-04T20:26:03.879262Z", - "shell.execute_reply": "2026-05-04T20:26:03.878646Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Summary document:\n", - " id: summary_user-ea5eba7a_807c3bc6-c021-4f66-b996-07bc5ef781ab\n", - " content: The conversation centered on planning a weekend trip to Seattle, including checking the weather, identifying flights and hotels near Pike Place Market within specified budgets, and establishing the us...\n", - " source_count: 11\n", - " embedding length: 1536\n" - ] - } - ], - "source": [ - "print(\"Summary document:\")\n", - "print(f\" id: {summary_doc['id']}\")\n", - "print(f\" content: {summary_doc['content'][:200]}...\")\n", - "print(f\" source_count: {summary_doc.get('metadata', {}).get('source_count')}\")\n", - "print(f\" embedding length: {len(summary_doc.get('embedding', []))}\")\n" - ] - }, - { - "cell_type": "markdown", - "id": "3cd2e4f8", - "metadata": {}, - "source": [ - "## 5. Memory Extraction (facts + episodic + procedural)\n", - "\n", - "`extract_memories()` runs a single LLM call that produces three structured memory types:\n", - "\n", - "| Type | Description |\n", - "|--------------|--------------------------------------------------------------------------|\n", - "| `fact` | Stable, atomic facts about the user. |\n", - "| `episodic` | Discrete past events the user described. |\n", - "| `procedural` | How-to guidance the agent should follow. |\n", - "\n", - "Each derived memory is embedded and stored in Cosmos DB with auto-generated tags and a salience score.\n" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "e4d57e2d", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:08:23.444563Z", - "start_time": "2026-04-07T22:08:17.255145Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:03.881644Z", - "iopub.status.busy": "2026-05-04T20:26:03.881553Z", - "iopub.status.idle": "2026-05-04T20:26:11.858903Z", - "shell.execute_reply": "2026-05-04T20:26:11.857972Z" - } - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "LLM model=gpt-5.2-chat rejected 'temperature'; retrying without it.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Seed thread extraction: {'facts_count': 1, 'procedural_count': 0, 'episodic_count': 0, 'updated_count': 0}\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "LLM model=gpt-5.2-chat rejected 'temperature'; retrying without it.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Rules thread extraction: {'facts_count': 0, 'procedural_count': 0, 'episodic_count': 0, 'updated_count': 0}\n" - ] - } - ], - "source": [ - "# Extract memories from both the SEED and the pure-procedural RULES thread.\n", - "result_main = await memory.extract_memories(user_id=USER_ID, thread_id=THREAD_ID)\n", - "print(\"Seed thread extraction:\", result_main)\n", - "\n", - "result_rules = await memory.extract_memories(user_id=USER_ID, thread_id=RULES_THREAD_ID)\n", - "print(\"Rules thread extraction:\", result_rules)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "795e8634", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:08:26.904418Z", - "start_time": "2026-04-07T22:08:26.587707Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:11.861697Z", - "iopub.status.busy": "2026-05-04T20:26:11.861551Z", - "iopub.status.idle": "2026-05-04T20:26:12.283813Z", - "shell.execute_reply": "2026-05-04T20:26:12.283042Z" - } - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "FACTS (3):\n", - " • The user prefers round-trip flights under $300. [salience=0.7]\n", - " • The user prefers hotels under $200 per night. [salience=0.7]\n", - " • The user prefers hotels located near Pike Place Market when staying in Seattle. [salience=0.6]\n", - "\n", - "EPISODICS (0):\n", - "\n", - "PROCEDURALS (7):\n", - " • Always book an aisle seat when reserving flights for the user, and never select a window or middle s [salience=0.9]\n", - " • For trip planning, first check the weather, then check flights, and book the hotel last after everyt [salience=0.85]\n", - " • Never book travel that departs or arrives between midnight and 6am unless the user explicitly approv [salience=0.9]\n", - " • Only recommend hotels that include complimentary breakfast. [salience=0.85]\n", - " • Always book an aisle seat and never select a window or middle seat when booking flights for the user [salience=0.9]\n", - " • Follow this trip planning order: first check the weather, then check flights, and book the hotel las [salience=0.85]\n", - " • Never book flights that depart or arrive between midnight and 6am unless the user explicitly approve [salience=0.9]\n" - ] - } - ], - "source": [ - "# Inspect the persisted derived memories across BOTH threads for this user.\n", - "for mt in (\"fact\", \"episodic\", \"procedural\"):\n", - " docs = await memory.get_memories(user_id=USER_ID, memory_types=[mt])\n", - " print(f\"\\n{mt.upper()}S ({len(docs)}):\")\n", - " for d in docs:\n", - " print(f\" • {d['content'][:100]} [salience={d.get('salience')}]\")\n" - ] - }, - { - "cell_type": "markdown", - "id": "3ad14e69", - "metadata": {}, - "source": [ - "## 6. User Summary (cross-thread profile)\n", - "\n", - "`generate_user_summary()` aggregates memories **across all threads** for a user and produces a structured profile (preferences, account state, behavioural patterns, …). The result is stored in Cosmos DB with `type: \"user_summary\"`.\n", - "\n", - "Retrieve the latest stored profile at any time with `get_user_summary(user_id)`.\n" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "cbd3806f", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:08:37.628678Z", - "start_time": "2026-04-07T22:08:29.322243Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:12.285934Z", - "iopub.status.busy": "2026-05-04T20:26:12.285802Z", - "iopub.status.idle": "2026-05-04T20:26:22.526266Z", - "shell.execute_reply": "2026-05-04T20:26:22.525613Z" - } - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "LLM model=gpt-5.2-chat rejected 'temperature'; retrying without it.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "User summary id: user_summary_user-ea5eba7a\n", - "\n", - "Content:\n", - " {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \"The user prefers aisle seats for all flight bookings and explicitly does not want window or middle seats.\",\n", - " \"The user does not want flights that depart or arrive between midnight and 6am unless they explicitly approve it.\",\n", - " \"For trip planning, the user prefers the workflow: first check the weather, then check flights, and book the hotel last after everything else is confirmed.\",\n", - " \"When selecting hotels, the user only wants options that include complimentary breakfast.\",\n", - " \"The user prefers round-trip flights under $300 when set ...\n", - "\n", - "Structured profile keys: ['key_facts', 'personal_preferences', 'account_environment', 'goals_current_work', 'behavioral_patterns', 'compliance_requirements', 'open_items', 'topics']\n" - ] - } - ], - "source": [ - "# Generate a user-level summary across all threads.\n", - "user_summary_doc = await memory.generate_user_summary(user_id=user_id)\n", - "print(\"User summary id:\", user_summary_doc[\"id\"])\n", - "print(\"\\nContent:\\n\", user_summary_doc[\"content\"][:600], \"...\")\n", - "print(\"\\nStructured profile keys:\", list(user_summary_doc.get(\"metadata\", {}).get(\"structured_summary\", {}).keys()))\n" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "97ddc94f", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:08:39.653532Z", - "start_time": "2026-04-07T22:08:39.229659Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:22.528078Z", - "iopub.status.busy": "2026-05-04T20:26:22.527959Z", - "iopub.status.idle": "2026-05-04T20:26:22.618478Z", - "shell.execute_reply": "2026-05-04T20:26:22.618055Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "User Summary for user-ea5eba7a\n", - "{\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \"The user prefers aisle seats for all flight bookings and explicitly does not want window or middle seats.\",\n", - " \"The user does not want flights that depart or arrive between midnight and 6am unless they explicitly approve it.\",\n", - " \"For trip planning, the user prefers the workflow: first check the weather, then check flights, and book the hotel last after everything else is confirmed.\",\n", - " \"When selecting hotels, the user only wants options that include complimentary breakfast.\",\n", - " \"The user prefers round-trip flights under $300 when setting flight budgets.\",\n", - " \"The user prefers hotels under $200 per night when setting lodging budgets.\",\n", - " \"When staying in Seattle, the user prefers hotels located near Pike Place Market.\"\n", - " ],\n", - " \"account_environment\": [],\n", - " \"goals_current_work\": [\n", - " \"The user is planning a weekend trip to Seattle with a goal of keeping flights under $300 round trip and hotels under $200 per night near Pike Place Market.\"\n", - " ],\n", - " \"behavioral_patterns\": [\n", - " \"The user provides clear, rule-based constraints for travel bookings and expects them to be remembered and consistently applied.\",\n", - " \"The user refines requirements mid-conversation, such as clarifying hotel budget limits.\",\n", - " \"The user repeats key travel preferences across threads to reinforce persistent booking rules.\"\n", - " ],\n", - " \"compliance_requirements\": [],\n", - " \"open_items\": [\n", - " \"No final decision has been made on whether to reserve the identified $275 round-trip Alaska Airlines flight to Seattle.\",\n", - " \"No hotel selection has been finalized between the Inn at the Market and the Hilton Garden Inn for the Seattle trip.\"\n", - " ],\n", - " \"topics\": [\n", - " \"travel\",\n", - " \"trip planning\",\n", - " \"flights\",\n", - " \"hotels\",\n", - " \"budget travel\",\n", - " \"seattle\"\n", - " ]\n", - "}\n" - ] - } - ], - "source": [ - "# Retrieve the stored user summary from Cosmos DB (async)\n", - "stored = await memory.get_user_summary(user_id=user_id)\n", - "if stored:\n", - " print(\"User Summary for\", user_id)\n", - " print(stored[\"content\"])\n", - "else:\n", - " print(\"No user summary found — run the generate_user_summary cell first.\")\n" - ] - }, - { - "cell_type": "markdown", - "id": "92e5d32b", - "metadata": {}, - "source": [ - "### 7. Vector search with `search_cosmos`\n", - "\n", - "Same as the sync version — embeds the query and runs a `VectorDistance` similarity search." - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "af4afa77", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:08:46.028010Z", - "start_time": "2026-04-07T22:08:43.195430Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:22.619506Z", - "iopub.status.busy": "2026-05-04T20:26:22.619453Z", - "iopub.status.idle": "2026-05-04T20:26:24.825313Z", - "shell.execute_reply": "2026-05-04T20:26:24.824663Z" - } - }, - "outputs": [], - "source": [ - "results_search_async = await memory.search_cosmos(\n", - " search_terms=\"What did the user ask about the weather?\",\n", - " user_id=USER_ID,\n", - " top_k=3, hybrid_search= True\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "id": "c0471fd4", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:08:47.537201Z", - "start_time": "2026-04-07T22:08:47.500038Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:24.827496Z", - "iopub.status.busy": "2026-05-04T20:26:24.827365Z", - "iopub.status.idle": "2026-05-04T20:26:24.830446Z", - "shell.execute_reply": "2026-05-04T20:26:24.829891Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Top 3 results:\n", - "\n", - " [summary_...] score=N/A The conversation centered on planning a weekend trip to Seat\n", - " [user_sum...] score=N/A {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \"The us\n", - " [fact_023...] score=N/A The user prefers hotels located near Pike Place Market when \n" - ] - } - ], - "source": [ - "print(f\"Top {len(results_search_async)} results:\\n\")\n", - "for r in results_search_async:\n", - " score = r.get(\"score\", \"N/A\")\n", - " print(f\" [{r['id'][:8]}...] score={score} {r['content'][:60]}\")" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "id": "bb4cc8f8", - "metadata": { - "ExecuteTime": { - "end_time": "2026-04-07T22:08:49.434405Z", - "start_time": "2026-04-07T22:08:49.164046Z" - }, - "execution": { - "iopub.execute_input": "2026-05-04T20:26:24.831979Z", - "iopub.status.busy": "2026-05-04T20:26:24.831863Z", - "iopub.status.idle": "2026-05-04T20:26:24.835490Z", - "shell.execute_reply": "2026-05-04T20:26:24.834936Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Async clients closed.\n" - ] - } - ], - "source": [ - "# Clean up async clients when done\n", - "await memory.close()\n", - "print(\"Async clients closed.\")" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "py314", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.15" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/Samples/Notebooks/Demo.ipynb b/Samples/Notebooks/Demo.ipynb new file mode 100644 index 0000000..496b569 --- /dev/null +++ b/Samples/Notebooks/Demo.ipynb @@ -0,0 +1,985 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "080f4913", + "metadata": {}, + "source": [ + "# Agent Memory Toolkit - Demo\n", + "\n", + "This notebook walks through the **Agent Memory Toolkit** library using the synchronous `CosmosMemoryClient` class:\n", + "\n", + "1. **Setup** - Install dependencies and load environment variables\n", + "2. **Local memory operations** - `add_local`, `get_local`, `update_local`, `delete_local`\n", + "3. **Cosmos DB operations** - `add_cosmos`, `get_memories`, `get_thread`\n", + "4. **Thread Summary** - `generate_thread_summary()` (in-process LLM)\n", + "5. **Memory Extraction** - `extract_memories()` (facts + episodic + procedural)\n", + "6. **User Summary** - `generate_user_summary()` (cross-thread profile)\n", + "7. **Vector / hybrid search** - `search_cosmos()`\n", + "8. **Tagging, salience & deduplication** - tag mutation, salience filter, `reconcile()`\n", + "9. **Automatic processing (Change Feed)** - optional Azure Function for background processing\n", + "\n", + "> **Tip:** the synchronous `CosmosMemoryClient` accepts an optional `processor=` kwarg (defaults to `InProcessProcessor`). Pass `DurableFunctionProcessor()` to delegate summarization to the sibling Azure Function app - see `Samples/Scenarios/scenario_remote_processor.py`." + ] + }, + { + "cell_type": "markdown", + "id": "4c72ab7a", + "metadata": {}, + "source": [ + "## 1. Setup\n", + "\n", + "Install/import dependencies and load environment variables from `.env`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "843cc6f6", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:50:21.928709Z", + "start_time": "2026-05-04T19:50:21.527024Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:45.174774Z", + "iopub.status.busy": "2026-05-04T20:26:45.174674Z", + "iopub.status.idle": "2026-05-04T20:26:45.425206Z", + "shell.execute_reply": "2026-05-04T20:26:45.424817Z" + } + }, + "outputs": [], + "source": [ + "import os, json\n", + "from dotenv import load_dotenv\n", + "from azure.identity import DefaultAzureCredential\n", + "\n", + "# Add repository root to path so we can import the package easily\n", + "import sys\n", + "sys.path.insert(0, os.path.abspath(\"../..\"))\n", + "from agent_memory_toolkit import CosmosMemoryClient\n", + "\n", + "# Load environment variables from .env in the repo root\n", + "load_dotenv(os.path.join(\"../..\", \".env\"))\n", + "print(\"COSMOS_DB_ENDPOINT:\", os.getenv(\"COSMOS_DB_ENDPOINT\"))\n", + "print(\"COSMOS_DB_DATABASE:\", os.getenv(\"COSMOS_DB_DATABASE\"))\n", + "print(\"COSMOS_DB_CONTAINER:\", os.getenv(\"COSMOS_DB_CONTAINER\"))\n", + "print(\"COSMOS_DB_COUNTERS_CONTAINER:\", os.getenv(\"COSMOS_DB_COUNTERS_CONTAINER\", \"counter\"))\n", + "print(\"COSMOS_DB_LEASE_CONTAINER:\", os.getenv(\"COSMOS_DB_LEASE_CONTAINER\", \"leases\"))\n", + "print(\"COSMOS_DB_THROUGHPUT_MODE:\", os.getenv(\"COSMOS_DB_THROUGHPUT_MODE\", \"serverless\"))\n", + "print(\"COSMOS_DB_AUTOSCALE_MAX_RU:\", os.getenv(\"COSMOS_DB_AUTOSCALE_MAX_RU\", \"(NA)\"))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bfc05f0f", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:50:26.577174Z", + "start_time": "2026-05-04T19:50:25.925102Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:45.426245Z", + "iopub.status.busy": "2026-05-04T20:26:45.426169Z", + "iopub.status.idle": "2026-05-04T20:26:45.930974Z", + "shell.execute_reply": "2026-05-04T20:26:45.930215Z" + } + }, + "outputs": [], + "source": [ + "# Create a CosmosMemoryClient instance.\n", + "# Credential priority: explicit cosmos_credential > explicit cosmos_key > DefaultAzureCredential.\n", + "# Set COSMOS_DB_KEY in your .env if you don't yet have control-plane RBAC (currently in private preview).\n", + "memory = CosmosMemoryClient(\n", + " cosmos_endpoint=os.getenv(\"COSMOS_DB_ENDPOINT\"),\n", + " cosmos_database=os.getenv(\"COSMOS_DB_DATABASE\"),\n", + " cosmos_container=os.getenv(\"COSMOS_DB_CONTAINER\"),\n", + " cosmos_counter_container=os.getenv(\"COSMOS_DB_COUNTERS_CONTAINER\", \"counter\"),\n", + " cosmos_lease_container=os.getenv(\"COSMOS_DB_LEASE_CONTAINER\", \"leases\"),\n", + " cosmos_throughput_mode=os.getenv(\"COSMOS_DB_THROUGHPUT_MODE\", \"serverless\"),\n", + " cosmos_autoscale_max_ru=int(os.getenv(\"COSMOS_DB_AUTOSCALE_MAX_RU\", \"1000\")),\n", + " cosmos_key=os.getenv(\"COSMOS_DB_KEY\"),\n", + " ai_foundry_endpoint=os.getenv(\"AI_FOUNDRY_ENDPOINT\"),\n", + " ai_foundry_api_key=os.getenv(\"AI_FOUNDRY_API_KEY\"),\n", + " embedding_deployment_name=os.getenv(\"AI_FOUNDRY_EMBEDDING_DEPLOYMENT_NAME\", \"text-embedding-3-large\"),\n", + " chat_deployment_name=os.getenv(\"AI_FOUNDRY_CHAT_DEPLOYMENT_NAME\", \"gpt-4o-mini\"),\n", + " use_default_credential=True,\n", + ")\n", + "\n", + "print(\"CosmosMemoryClient instance created\")\n", + "print(\"Throughput mode:\", os.getenv(\"COSMOS_DB_THROUGHPUT_MODE\", \"serverless\"))\n", + "print(\"Local memory store:\", memory.local_memory)\n" + ] + }, + { + "cell_type": "markdown", + "id": "630ce536", + "metadata": {}, + "source": [ + "## 2. Local Memory Operations\n", + "\n", + "### 2a. Add memories with `add_local`\n", + "\n", + "Each memory has a `user_id`, `role`, `content`, optional `type` (raw/summary/fact), and optional `metadata`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d7c1bdc2", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:50:29.762172Z", + "start_time": "2026-05-04T19:50:29.732980Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:45.932875Z", + "iopub.status.busy": "2026-05-04T20:26:45.932737Z", + "iopub.status.idle": "2026-05-04T20:26:45.936154Z", + "shell.execute_reply": "2026-05-04T20:26:45.935563Z" + } + }, + "outputs": [], + "source": [ + "import uuid\n", + "THREAD_ID = str(uuid.uuid4())\n", + "# Use a unique user_id per demo run so we get a clean extraction without\n", + "# inheriting facts from prior runs that would dedup new content away.\n", + "USER_ID = f\"user-{uuid.uuid4().hex[:8]}\"\n", + "print(f\"User ID: {USER_ID}\")\n", + "print(f\"Thread ID: {THREAD_ID}\\n\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8e5eafcd", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:50:31.130333Z", + "start_time": "2026-05-04T19:50:31.098819Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:45.937757Z", + "iopub.status.busy": "2026-05-04T20:26:45.937671Z", + "iopub.status.idle": "2026-05-04T20:26:45.945112Z", + "shell.execute_reply": "2026-05-04T20:26:45.944708Z" + } + }, + "outputs": [], + "source": [ + "# Add sample conversation: weather in Seattle → booking a trip (6 turns)\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", + " content=\"What's the weather like in Seattle this weekend?\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", + " content=\"This weekend Seattle will be around 55°F with partly cloudy skies on Saturday and light rain expected Sunday.\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", + " content=\"That sounds nice enough. Can you help me book a trip to Seattle for this weekend?\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", + " content=\"Sure! I found round-trip flights departing Friday evening and returning Sunday night. There are also several hotels in downtown Seattle with availability. Would you like me to look at specific airlines or neighborhoods?\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", + " content=\"Something near Pike Place Market would be great. And keep the flights under $300 round trip if possible.\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", + " content=\"I found a round-trip on Alaska Airlines for $275 and two hotel options within a 5-minute walk of Pike Place Market: the Inn at the Market ($189/night) and a Hilton Garden Inn ($145/night). Want me to reserve one of these?\",\n", + ")\n", + "\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", + " content=\"Whenever you book a flight for me, always book an aisle seat — never a window or middle.\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", + " content=\"Got it. I'll always select an aisle seat for your bookings.\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", + " content=\"For trip planning, my workflow is: first check the weather for the destination, then check flights, then book the hotel last after everything else is confirmed.\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", + " content=\"Noted — I'll follow that order: weather, then flights, then hotel.\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", + " content=\"And never book me into anything that departs or arrives between midnight and 6am unless I explicitly approve it.\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", + " content=\"Will do — no overnight bookings without your explicit approval.\",\n", + ")\n", + "\n", + "print(f\"Added {len(memory.local_memory)} memories\")\n", + "print(json.dumps(memory.get_local(), indent=2))\n", + "\n", + "# A second short thread of pure procedural-style instructions. Demonstrates\n", + "# that the extractor produces clean procedural items when the conversation is\n", + "# focused on rules/workflows rather than mixed with factual booking specifics.\n", + "RULES_THREAD_ID = str(uuid.uuid4())\n", + "for role, content in [\n", + " (\"user\", \"Whenever you book a flight for me, always book an aisle seat — never a window or middle.\"),\n", + " (\"agent\", \"Got it. I'll always select an aisle seat for your bookings.\"),\n", + " (\"user\", \"For trip planning, my workflow is: first check the weather, then check flights, and book the hotel last after everything else is confirmed.\"),\n", + " (\"agent\", \"Noted — I'll follow that order: weather, then flights, then hotel.\"),\n", + " (\"user\", \"Never book me into anything that departs or arrives between midnight and 6am unless I explicitly approve it.\"),\n", + " (\"agent\", \"Will do — no overnight bookings without your explicit approval.\"),\n", + " (\"user\", \"When picking a hotel, only recommend ones that include complimentary breakfast.\"),\n", + " (\"agent\", \"Understood — only hotels with complimentary breakfast.\"),\n", + "]:\n", + " memory.add_local(user_id=USER_ID, role=role, thread_id=RULES_THREAD_ID, content=content)\n", + "\n", + "print(f\"Rules thread ID: {RULES_THREAD_ID} ({sum(1 for m in memory.local_memory if m['thread_id']==RULES_THREAD_ID)} turns)\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "cf15cfcf", + "metadata": {}, + "source": [ + "### 2b. Query memories with `get_local`\n", + "\n", + "Retrieve all memories, or filter by `memory_id`, `user_id`, `role`, or `memory_type`. Filters are combined with AND logic." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c58a71ce", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:50:34.927677Z", + "start_time": "2026-05-04T19:50:34.908938Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:45.946689Z", + "iopub.status.busy": "2026-05-04T20:26:45.946605Z", + "iopub.status.idle": "2026-05-04T20:26:45.949420Z", + "shell.execute_reply": "2026-05-04T20:26:45.948952Z" + } + }, + "outputs": [], + "source": [ + "# Get all memories\n", + "all_memories = memory.get_local()\n", + "print(f\"Total memories: {len(all_memories)}\\n\")\n", + "\n", + "# Filter by user_id\n", + "user1_memories = memory.get_local(user_id=USER_ID)\n", + "print(f\"Memories for user-001: {len(user1_memories)}\")\n", + "\n", + "# Filter by role\n", + "tool_memories = memory.get_local(role=\"tool\")\n", + "print(f\"Tool memories: {len(tool_memories)}\")\n", + "for m in tool_memories:\n", + " print(f\" [{m['id'][:8]}...] {m['content'][:60]}\")\n", + "\n", + "# Filter by type\n", + "facts = memory.get_local(memory_types=[\"fact\"])\n", + "print(f\"\\nFact memories: {len(facts)}\")\n", + "for m in facts:\n", + " print(f\" [{m['id'][:8]}...] {m['content']}\")\n", + "\n", + "# Combine filters: user-001 + agent role\n", + "user1_agent = memory.get_local(user_id=USER_ID, role=\"agent\")\n", + "print(f\"\\nAgent memories for user-001: {len(user1_agent)}\")" + ] + }, + { + "cell_type": "markdown", + "id": "871b7cfa", + "metadata": {}, + "source": [ + "### 2c. Update a memory with `update_local`\n", + "\n", + "Update any combination of `content`, `role`, `memory_type`, or `metadata` for an existing memory by its `id`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "da42d953", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:50:37.601997Z", + "start_time": "2026-05-04T19:50:37.567424Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:45.950727Z", + "iopub.status.busy": "2026-05-04T20:26:45.950648Z", + "iopub.status.idle": "2026-05-04T20:26:45.953103Z", + "shell.execute_reply": "2026-05-04T20:26:45.952670Z" + } + }, + "outputs": [], + "source": [ + "# Update the user's budget constraint to be more specific\n", + "target_id = memory.local_memory[4][\"id\"] # \"Something near Pike Place Market...\"\n", + "print(f\"Before update:\\n{json.dumps(memory.get_local(memory_id=target_id)[0], indent=2)}\\n\")\n", + "\n", + "memory.update_local(\n", + " memory_id=target_id,\n", + " content=\"Something near Pike Place Market would be great. Keep flights under $300 round trip and hotels under $200/night.\",\n", + " metadata={\"edited\": True, \"reason\": \"user clarified hotel budget\"},\n", + ")\n", + "print(f\"After update:\\n{json.dumps(memory.get_local(memory_id=target_id)[0], indent=2)}\")" + ] + }, + { + "cell_type": "markdown", + "id": "ab7b5085", + "metadata": {}, + "source": [ + "### 2d. Delete a memory with `delete_local`\n", + "\n", + "Remove a memory by its `id`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8dea4bad", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:50:40.888339Z", + "start_time": "2026-05-04T19:50:40.858576Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:45.954501Z", + "iopub.status.busy": "2026-05-04T20:26:45.954409Z", + "iopub.status.idle": "2026-05-04T20:26:45.956864Z", + "shell.execute_reply": "2026-05-04T20:26:45.956501Z" + } + }, + "outputs": [], + "source": [ + "# Delete the user's booking request by role/content instead of a fixed index\n", + "booking_requests = [\n", + " m for m in memory.get_local(user_id=USER_ID, role=\"user\")\n", + " if \"book a trip to Seattle\" in m[\"content\"]\n", + "]\n", + "if not booking_requests:\n", + " raise ValueError(\"Expected to find the user's Seattle booking request.\")\n", + "\n", + "delete_target = booking_requests[0]\n", + "delete_target_id = delete_target[\"id\"]\n", + "print(f\"Deleting user memory {delete_target_id[:8]}... {delete_target['content'][:60]}\")\n", + "memory.delete_local(delete_target_id)\n", + "\n", + "# Verify it's gone\n", + "print(f\"\\nRemaining memories: {len(memory.get_local())}\")\n", + "for m in memory.get_local():\n", + " print(f\" [{m['thread_id'][:8]}...] [{m['id'][:8]}...] role={m['role']:<6} type={m['type']:<8} {m['content'][:50]}\")" + ] + }, + { + "cell_type": "markdown", + "id": "c5fb8224", + "metadata": {}, + "source": [ + "## 3. Cosmos DB Operations\n", + "\n", + "### 3a. Cosmos DB Connection\n", + "\n", + "The client auto-connects to Cosmos DB when `cosmos_endpoint` is provided in the constructor. You can also call `connect_cosmos()` explicitly to reconnect or override connection parameters.\n", + "\n", + "> **Prerequisites:**\n", + "> - A Cosmos DB for NoSQL account with a database and container matching your `.env` values\n", + "> - The container should have a [vector embedding policy](https://learn.microsoft.com/azure/cosmos-db/nosql/vector-search) configured on the `embedding` field\n", + "> - Entra ID / managed identity RBAC role (e.g. *Cosmos DB Built-in Data Contributor*)\n", + "> - An Azure AI Foundry embedding model deployment for `add_cosmos` and `search_cosmos`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7ab2774c", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:50:43.406979Z", + "start_time": "2026-05-04T19:50:43.381359Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:45.958017Z", + "iopub.status.busy": "2026-05-04T20:26:45.957936Z", + "iopub.status.idle": "2026-05-04T20:26:45.959723Z", + "shell.execute_reply": "2026-05-04T20:26:45.959390Z" + } + }, + "outputs": [], + "source": [ + "# Already connected via constructor — call connect_cosmos() only if you need to reconnect\n", + "print(f\"Connected: {memory._container_client is not None}\")" + ] + }, + { + "cell_type": "markdown", + "id": "4b497000", + "metadata": {}, + "source": [ + "### 3b. Add memories to Cosmos DB with `add_cosmos`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "940034e6", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:47:06.565165Z", + "start_time": "2026-05-04T19:47:06.416457Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:45.960747Z", + "iopub.status.busy": "2026-05-04T20:26:45.960690Z", + "iopub.status.idle": "2026-05-04T20:26:46.487278Z", + "shell.execute_reply": "2026-05-04T20:26:46.486386Z" + } + }, + "outputs": [], + "source": [ + "memory.push_to_cosmos()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "35d972e3", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:50:44.709781Z", + "start_time": "2026-05-04T19:50:44.527683Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:46.490001Z", + "iopub.status.busy": "2026-05-04T20:26:46.489835Z", + "iopub.status.idle": "2026-05-04T20:26:46.651391Z", + "shell.execute_reply": "2026-05-04T20:26:46.650680Z" + } + }, + "outputs": [], + "source": [ + "# Push a new thread directly to Cosmos DB without adding to local memory first\n", + "new_thread_id = str(uuid.uuid4())\n", + "print(f\"New Thread ID: {new_thread_id}\\n\")\n", + "\n", + "# Add memories directly to Cosmos DB using add_cosmos\n", + "memory.add_cosmos(\n", + " user_id=\"user-002\", role=\"user\", thread_id=new_thread_id,\n", + " content=\"Can you recommend some good restaurants in New York City?\",\n", + ")\n", + "memory.add_cosmos(\n", + " user_id=\"user-002\", role=\"tool\", thread_id=new_thread_id,\n", + " content='{\"query\": \"top restaurants NYC\", \"results\": [\"Carbone\", \"Nobu\", \"Katz\\'s Deli\", \"Le Bernardin\"]}',\n", + " metadata={\"tool_name\": \"restaurant_search\", \"tool_call_id\": \"call_abc123\"},\n", + ")\n", + "memory.add_cosmos(\n", + " user_id=\"user-002\", role=\"agent\", thread_id=new_thread_id,\n", + " content=\"Absolutely! NYC has incredible dining options. For Italian, try Carbone in Greenwich Village. For sushi, Nobu in Tribeca is world-class. For a classic NYC experience, Katz's Delicatessen on the Lower East Side is a must.\",\n", + ")\n", + "memory.add_cosmos(\n", + " user_id=\"user-002\", role=\"user\", thread_id=new_thread_id,\n", + " content=\"I love Italian food. Are there any options that are budget-friendly?\",\n", + ")\n", + "memory.add_cosmos(\n", + " user_id=\"user-002\", role=\"agent\", thread_id=new_thread_id,\n", + " content=\"For budget-friendly Italian in NYC, check out L'industrie Pizzeria in Williamsburg or Artichoke Basille's Pizza. Both are highly rated and won't break the bank.\",\n", + ")\n", + "\n", + "# Verify the memories were added directly to Cosmos DB (not in local memory)\n", + "print(f\"Local memory count (should be unchanged): {len(memory.local_memory)}\\n\")\n", + "\n", + "cosmos_results = memory.get_memories(user_id=\"user-002\", thread_id=new_thread_id)\n", + "print(f\"Memories in Cosmos DB for new thread: {len(cosmos_results)}\")\n", + "for r in cosmos_results:\n", + " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} {r['content'][:60]}\")" + ] + }, + { + "cell_type": "markdown", + "id": "40d603f1", + "metadata": {}, + "source": [ + "### 3c. Retrieve memories from Cosmos DB with `get_memories`\n", + "\n", + "Supports the same filters as `get_local`: `memory_id`, `user_id`, `role`, `memory_type`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c953c0c6", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:50:46.986830Z", + "start_time": "2026-05-04T19:50:46.739178Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:46.653079Z", + "iopub.status.busy": "2026-05-04T20:26:46.652949Z", + "iopub.status.idle": "2026-05-04T20:26:46.794147Z", + "shell.execute_reply": "2026-05-04T20:26:46.793081Z" + } + }, + "outputs": [], + "source": [ + "# Get all memories for user-001\n", + "results = memory.get_memories(user_id=USER_ID)\n", + "print(f\"Memories for user-001: {len(results)}\\n\")\n", + "for r in results:\n", + " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} type={r['type']:<8} {r['content'][:50]}\")\n", + "\n", + "# Get only agent memories\n", + "agent_results = memory.get_memories(role=\"agent\")\n", + "print(f\"\\nAgent memories: {len(agent_results)}\")\n", + "for r in agent_results:\n", + " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} type={r['type']:<8} {r['content'][:50]}\")" + ] + }, + { + "cell_type": "markdown", + "id": "167de1b9", + "metadata": {}, + "source": [ + "### 3d. Update & Delete in Cosmos DB\n", + "\n", + "`update_cosmos` and `delete_cosmos` work just like their local counterparts. If the content changes, the embedding is automatically re-generated." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1e41f9cb", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:50:51.818340Z", + "start_time": "2026-05-04T19:50:51.660999Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:46.796271Z", + "iopub.status.busy": "2026-05-04T20:26:46.796138Z", + "iopub.status.idle": "2026-05-04T20:26:46.891804Z", + "shell.execute_reply": "2026-05-04T20:26:46.890873Z" + } + }, + "outputs": [], + "source": [ + "# Update the user's budget message to add a hotel budget constraint\n", + "user_msgs = memory.get_memories(user_id=USER_ID, role=\"user\")\n", + "target = [m for m in user_msgs if \"Pike Place\" in m[\"content\"]][0]\n", + "print(f\"Before: {target['content']}\\n\")\n", + "\n", + "memory.update_cosmos(\n", + " memory_id=target[\"id\"],\n", + " content=\"Something near Pike Place Market would be great. Keep flights under $300 round trip and hotels under $200/night.\",\n", + " metadata={\"edited\": True, \"reason\": \"user clarified hotel budget\"},\n", + ")\n", + "\n", + "updated = memory.get_memories(memory_id=target[\"id\"])[0]\n", + "print(f\"After: {updated['content']}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f00ef033", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:50:53.902331Z", + "start_time": "2026-05-04T19:50:53.061878Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:46.893830Z", + "iopub.status.busy": "2026-05-04T20:26:46.893695Z", + "iopub.status.idle": "2026-05-04T20:26:50.409303Z", + "shell.execute_reply": "2026-05-04T20:26:50.408798Z" + } + }, + "outputs": [], + "source": [ + "# Delete the tool memory from Cosmos\n", + "tool_mems = memory.get_memories(user_id=\"user-002\", role=\"tool\")\n", + "print(tool_mems[0])\n", + "if tool_mems:\n", + " memory.delete_cosmos(\n", + " tool_mems[0][\"id\"],\n", + " thread_id=tool_mems[0][\"thread_id\"],\n", + " user_id=tool_mems[0][\"user_id\"],\n", + " )\n", + " print(f\"Deleted tool memory {tool_mems[0]['id'][:8]}...\")\n", + "\n", + "# Verify\n", + "remaining = memory.get_memories()\n", + "print(f\"\\nRemaining memories in Cosmos DB: {len(remaining)}\")\n", + "for r in remaining:\n", + " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} type={r['type']:<8} {r['content'][:50]}\")" + ] + }, + { + "cell_type": "markdown", + "id": "d177810a", + "metadata": {}, + "source": [ + "### 3e. Retrieve a full thread with `get_thread`\n", + "\n", + "`get_thread` fetches all memories for a given `thread_id` from Cosmos DB, returned in chronological order (oldest first).\n", + "\n", + "- **`thread_id`** (required) – the thread to retrieve\n", + "- **`user_id`** (optional) – filter to a specific user\n", + "- **`recent_k`** (optional) – return only the *k* most recent documents; omit to get all" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d27e2c80", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:50:56.348243Z", + "start_time": "2026-05-04T19:50:56.027458Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:50.411141Z", + "iopub.status.busy": "2026-05-04T20:26:50.411056Z", + "iopub.status.idle": "2026-05-04T20:26:50.605647Z", + "shell.execute_reply": "2026-05-04T20:26:50.605066Z" + } + }, + "outputs": [], + "source": [ + "# Use the CURRENT seed thread (from cell 5) so we operate on the data we just wrote.\n", + "thread_id = THREAD_ID\n", + "print(f\"Using thread_id: {thread_id}\\n\")\n", + "\n", + "# Get all documents in the thread\n", + "thread_all = memory.get_thread(thread_id=thread_id)\n", + "print(f\"All memories in thread: {len(thread_all)}\")\n", + "for m in thread_all:\n", + " print(f\" [{m['thread_id'][:8]}...] [{m['id'][:8]}...] role={m.get('role','?'):6} type={m['type']:8} {m['content'][:60]}\")\n", + "\n", + "# Most recent 2\n", + "recent = memory.get_thread(thread_id=thread_id, recent_k=2)\n", + "print(f\"\\nMost recent 2 memories:\")\n", + "for m in recent:\n", + " print(f\" [{m['thread_id'][:8]}...] [{m['id'][:8]}...] role={m.get('role','?'):6} type={m['type']:8} {m['content'][:60]}\")\n", + "\n", + "# Filter to a specific user\n", + "thread_user = memory.get_thread(thread_id=thread_id, user_id=USER_ID)\n", + "print(f\"\\nThread memories for user-001: {len(thread_user)}\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "adfa2a66", + "metadata": {}, + "source": [ + "## 4. Thread Summary (in-process)\n", + "\n", + "`generate_thread_summary()` runs the summarisation pipeline **in-process** — no Azure Functions\n", + "required. It will:\n", + "\n", + "1. Query Cosmos DB for memories matching the given `user_id` + `thread_id`.\n", + "2. Optionally keep only the **k most recent** documents (`recent_k`).\n", + "3. Call the configured AI Foundry LLM to produce a structured summary.\n", + "4. Generate a vector embedding of the summary.\n", + "5. Upsert the result back into Cosmos DB as a memory of type `\"summary\"`.\n", + "\n", + "If a prior summary exists, the call performs an **incremental update** that preserves the\n", + "metadata-tracked `source_count`.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ccbf3c6762ca4ffc", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:50:58.760327Z", + "start_time": "2026-05-04T19:50:58.625811Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:50.607649Z", + "iopub.status.busy": "2026-05-04T20:26:50.607529Z", + "iopub.status.idle": "2026-05-04T20:27:01.949372Z", + "shell.execute_reply": "2026-05-04T20:27:01.948569Z" + } + }, + "outputs": [], + "source": [ + "# Use the CURRENT seed thread (from cell 5) so summarisation operates on the new data.\n", + "thread_id = THREAD_ID\n", + "user_id = USER_ID\n", + "print(f\"Summarizing thread_id={thread_id} user_id={user_id}\\n\")\n", + "\n", + "# Run the thread summary pipeline (in-process). Returns the persisted summary doc.\n", + "summary_doc = memory.generate_thread_summary(user_id=user_id, thread_id=thread_id)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d5f360c618f237ca", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:51:01.923467Z", + "start_time": "2026-05-04T19:51:01.886475Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:27:01.951750Z", + "iopub.status.busy": "2026-05-04T20:27:01.951586Z", + "iopub.status.idle": "2026-05-04T20:27:01.954872Z", + "shell.execute_reply": "2026-05-04T20:27:01.954192Z" + } + }, + "outputs": [], + "source": [ + "print(\"Summary document:\")\n", + "print(f\" id: {summary_doc['id']}\")\n", + "print(f\" content: {summary_doc['content'][:200]}...\")\n", + "print(f\" source_count: {summary_doc.get('metadata', {}).get('source_count')}\")\n", + "print(f\" embedding length: {len(summary_doc.get('embedding', []))}\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "3b932f35", + "metadata": {}, + "source": [ + "## 5. Memory Extraction (facts + episodic + procedural)\n", + "\n", + "`extract_memories()` runs a single LLM call that produces three structured memory types:\n", + "\n", + "| Type | Description |\n", + "|-------------|--------------------------------------------------------------------------|\n", + "| `fact` | Stable, atomic facts about the user. |\n", + "| `episodic` | Discrete past events (\"Last spring, the user hiked Mount Rainier.\"). |\n", + "| `procedural`| How-to guidance the agent should follow (\"When debugging the LLM, ...\").|\n", + "\n", + "Each derived memory is embedded and stored in Cosmos DB with auto-generated tags and a\n", + "salience score. The call returns a count summary.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ae73f87c", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:51:19.112267Z", + "start_time": "2026-05-04T19:51:04.510037Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:27:01.956444Z", + "iopub.status.busy": "2026-05-04T20:27:01.956348Z", + "iopub.status.idle": "2026-05-04T20:27:08.337601Z", + "shell.execute_reply": "2026-05-04T20:27:08.336433Z" + } + }, + "outputs": [], + "source": [ + "# Extract memories from the SEED thread (mixed factual + booking specifics).\n", + "result_main = memory.extract_memories(user_id=USER_ID, thread_id=THREAD_ID)\n", + "print(\"Seed thread extraction:\", result_main)\n", + "\n", + "# Extract from the pure-procedural RULES thread to surface procedural memories.\n", + "result_rules = memory.extract_memories(user_id=USER_ID, thread_id=RULES_THREAD_ID)\n", + "print(\"Rules thread extraction:\", result_rules)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4cbe2ff4", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:51:22.391047Z", + "start_time": "2026-05-04T19:51:22.282774Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:27:08.340224Z", + "iopub.status.busy": "2026-05-04T20:27:08.340031Z", + "iopub.status.idle": "2026-05-04T20:27:08.473245Z", + "shell.execute_reply": "2026-05-04T20:27:08.472613Z" + } + }, + "outputs": [], + "source": [ + "# Inspect the persisted derived memories across BOTH threads for this user.\n", + "for mt in (\"fact\", \"episodic\", \"procedural\"):\n", + " docs = memory.get_memories(user_id=USER_ID, memory_types=[mt])\n", + " print(f\"\\n{mt.upper()}S ({len(docs)}):\")\n", + " for d in docs:\n", + " print(f\" • {d['content'][:100]} [salience={d.get('salience')}]\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "4f9db816", + "metadata": {}, + "source": [ + "## 6. User Summary (cross-thread profile)\n", + "\n", + "`generate_user_summary()` aggregates memories **across all threads** for a user and produces\n", + "a structured profile (preferences, account state, behavioural patterns, …). The result is\n", + "stored in Cosmos DB with `type: \"user_summary\"`.\n", + "\n", + "- **`user_id`** (required) – the user to build the profile for\n", + "- **`thread_ids`** (optional) – limit to specific threads; omit for all threads\n", + "- **`recent_k`** (optional) – per-thread recency limit\n", + "\n", + "Retrieve the latest stored profile at any time with `get_user_summary(user_id)` — useful\n", + "for priming new conversations.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e248f5f8", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:51:40.206458Z", + "start_time": "2026-05-04T19:51:32.902642Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:27:08.474717Z", + "iopub.status.busy": "2026-05-04T20:27:08.474603Z", + "iopub.status.idle": "2026-05-04T20:27:17.174075Z", + "shell.execute_reply": "2026-05-04T20:27:17.173319Z" + } + }, + "outputs": [], + "source": [ + "# Generate a user-level summary across all threads for user_id.\n", + "user_summary_doc = memory.generate_user_summary(user_id=user_id)\n", + "print(\"User summary id:\", user_summary_doc[\"id\"])\n", + "print(\"\\nContent:\\n\", user_summary_doc[\"content\"][:600], \"...\")\n", + "print(\"\\nStructured profile keys:\", list(user_summary_doc.get(\"metadata\", {}).get(\"structured_summary\", {}).keys()))\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6a6483c8", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:51:44.920125Z", + "start_time": "2026-05-04T19:51:44.831055Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:27:17.176169Z", + "iopub.status.busy": "2026-05-04T20:27:17.176040Z", + "iopub.status.idle": "2026-05-04T20:27:17.240128Z", + "shell.execute_reply": "2026-05-04T20:27:17.239204Z" + } + }, + "outputs": [], + "source": [ + "# Retrieve the stored user summary from Cosmos DB\n", + "stored = memory.get_user_summary(user_id=user_id)\n", + "if stored:\n", + " print(\"User Summary for\", user_id)\n", + " print(stored[\"content\"])\n", + "else:\n", + " print(\"No user summary found — run the generate_user_summary cell first.\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "f34532d8", + "metadata": {}, + "source": [ + "### 7. Vector search with `search_cosmos`\n", + "\n", + "`search_cosmos` embeds a natural-language query via your AI Foundry model and runs a `VectorDistance` similarity search in Cosmos DB. Optionally filter by `user_id` or `thread_id`.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8cad9e1c", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:51:48.450405Z", + "start_time": "2026-05-04T19:51:47.803095Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:27:17.242064Z", + "iopub.status.busy": "2026-05-04T20:27:17.241948Z", + "iopub.status.idle": "2026-05-04T20:27:17.723314Z", + "shell.execute_reply": "2026-05-04T20:27:17.722345Z" + } + }, + "outputs": [], + "source": [ + "results = memory.search_cosmos(\n", + " search_terms=\"What did the user ask about the weather?\",\n", + " user_id=USER_ID,\n", + " top_k=3,\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "73ea6150", + "metadata": { + "ExecuteTime": { + "end_time": "2026-05-04T19:51:49.865957Z", + "start_time": "2026-05-04T19:51:49.841121Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:27:17.725695Z", + "iopub.status.busy": "2026-05-04T20:27:17.725537Z", + "iopub.status.idle": "2026-05-04T20:27:17.728740Z", + "shell.execute_reply": "2026-05-04T20:27:17.728106Z" + } + }, + "outputs": [], + "source": [ + "print(f\"Top {len(results)} results:\\n\")\n", + "for r in results:\n", + " score = r.get(\"score\", \"N/A\")\n", + " print(f\" [{r['id'][:8]}...] score={score} {r['content'][:60]}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1d2185169357621f", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "py314", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.15" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/Samples/Notebooks/Demo_async.ipynb b/Samples/Notebooks/Demo_async.ipynb new file mode 100644 index 0000000..30c82d7 --- /dev/null +++ b/Samples/Notebooks/Demo_async.ipynb @@ -0,0 +1,940 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "04a283f1", + "metadata": {}, + "source": [ + "## 1. Setup\n", + "\n", + "Install/import dependencies and load environment variables from `.env`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "15434fb9", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:06:39.082693Z", + "start_time": "2026-04-07T22:06:38.712684Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:25:45.211452Z", + "iopub.status.busy": "2026-05-04T20:25:45.211356Z", + "iopub.status.idle": "2026-05-04T20:25:45.346501Z", + "shell.execute_reply": "2026-05-04T20:25:45.346098Z" + } + }, + "outputs": [], + "source": [ + "import os, json, sys\n", + "from pathlib import Path\n", + "sys.path.insert(0, os.path.abspath(\"../..\"))\n", + "from dotenv import load_dotenv\n", + "from agent_memory_toolkit.aio import AsyncCosmosMemoryClient\n", + "\n", + "# Load environment variables from .env in the repo root\n", + "\n", + "load_dotenv(os.path.join(\"../..\", \".env\"))\n", + "print(\"COSMOS_DB_ENDPOINT:\", os.getenv(\"COSMOS_DB_ENDPOINT\"))\n", + "print(\"COSMOS_DB_DATABASE:\", os.getenv(\"COSMOS_DB_DATABASE\"))\n", + "print(\"COSMOS_DB_CONTAINER:\", os.getenv(\"COSMOS_DB_CONTAINER\"))\n", + "print(\"COSMOS_DB_COUNTERS_CONTAINER:\", os.getenv(\"COSMOS_DB_COUNTERS_CONTAINER\", \"counter\"))\n", + "print(\"COSMOS_DB_LEASE_CONTAINER:\", os.getenv(\"COSMOS_DB_LEASE_CONTAINER\", \"leases\"))\n", + "print(\"COSMOS_DB_THROUGHPUT_MODE:\", os.getenv(\"COSMOS_DB_THROUGHPUT_MODE\", \"serverless\"))\n", + "print(\"COSMOS_DB_AUTOSCALE_MAX_RU:\", os.getenv(\"COSMOS_DB_AUTOSCALE_MAX_RU\", \"(NA)\"))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "75bf151787e8aaa2", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:06:41.229355Z", + "start_time": "2026-04-07T22:06:41.014359Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:25:45.347628Z", + "iopub.status.busy": "2026-05-04T20:25:45.347566Z", + "iopub.status.idle": "2026-05-04T20:25:45.652841Z", + "shell.execute_reply": "2026-05-04T20:25:45.652467Z" + } + }, + "outputs": [], + "source": [ + "from azure.identity.aio import DefaultAzureCredential as AsyncDefaultAzureCredential\n", + "\n", + "# Credential priority: explicit cosmos_credential > explicit cosmos_key > DefaultAzureCredential.\n", + "# Set COSMOS_DB_KEY in your .env if you don't yet have control-plane RBAC (currently in private preview).\n", + "memory = AsyncCosmosMemoryClient(\n", + " cosmos_endpoint=os.getenv(\"COSMOS_DB_ENDPOINT\"),\n", + " cosmos_database=os.getenv(\"COSMOS_DB_DATABASE\"),\n", + " cosmos_container=os.getenv(\"COSMOS_DB_CONTAINER\"),\n", + " cosmos_counter_container=os.getenv(\"COSMOS_DB_COUNTERS_CONTAINER\", \"counter\"),\n", + " cosmos_lease_container=os.getenv(\"COSMOS_DB_LEASE_CONTAINER\", \"leases\"),\n", + " cosmos_throughput_mode=os.getenv(\"COSMOS_DB_THROUGHPUT_MODE\", \"serverless\"),\n", + " cosmos_autoscale_max_ru=int(os.getenv(\"COSMOS_DB_AUTOSCALE_MAX_RU\", \"1000\")),\n", + " cosmos_key=os.getenv(\"COSMOS_DB_KEY\"),\n", + " ai_foundry_endpoint=os.getenv(\"AI_FOUNDRY_ENDPOINT\"),\n", + " ai_foundry_api_key=os.getenv(\"AI_FOUNDRY_API_KEY\"),\n", + " embedding_deployment_name=os.getenv(\"AI_FOUNDRY_EMBEDDING_DEPLOYMENT_NAME\", \"text-embedding-3-large\"),\n", + " chat_deployment_name=os.getenv(\"AI_FOUNDRY_CHAT_DEPLOYMENT_NAME\", \"gpt-4o-mini\"),\n", + " use_default_credential=True,\n", + ")\n", + "\n", + "print(\"AsyncCosmosMemoryClient instance created\")\n", + "print(\"Throughput mode:\", os.getenv(\"COSMOS_DB_THROUGHPUT_MODE\", \"serverless\"))\n", + "print(\"Local memory store:\", memory.local_memory)\n" + ] + }, + { + "cell_type": "markdown", + "id": "3ed9ad79", + "metadata": {}, + "source": [ + "## 2. Local Memory Operations\n", + "\n", + "`AsyncCosmosMemoryClient` mirrors the sync API. Local operations (`add_local`, `get_local`, `update_local`, `delete_local`) are synchronous under the hood (in-memory list), but the class is designed for use in async code paths.\n", + "\n", + "> **Note:** In Jupyter you can `await` directly in cells without wrapping in `asyncio.run()`." + ] + }, + { + "cell_type": "markdown", + "id": "56eadc55", + "metadata": {}, + "source": [ + "### 2a. Add memories with `add_local`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5619b2ed", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:06:45.409758Z", + "start_time": "2026-04-07T22:06:45.149684Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:25:45.653810Z", + "iopub.status.busy": "2026-05-04T20:25:45.653720Z", + "iopub.status.idle": "2026-05-04T20:25:45.655764Z", + "shell.execute_reply": "2026-05-04T20:25:45.655372Z" + } + }, + "outputs": [], + "source": [ + "import uuid\n", + "THREAD_ID = str(uuid.uuid4())\n", + "# Use a unique user_id per demo run so we get a clean extraction without\n", + "# inheriting facts from prior runs that would dedup new content away.\n", + "USER_ID = f\"user-{uuid.uuid4().hex[:8]}\"\n", + "print(f\"User ID: {USER_ID}\")\n", + "print(f\"Thread ID: {THREAD_ID}\\n\")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5ce1b88c", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:06:47.709471Z", + "start_time": "2026-04-07T22:06:47.682021Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:25:45.656663Z", + "iopub.status.busy": "2026-05-04T20:25:45.656610Z", + "iopub.status.idle": "2026-05-04T20:25:45.660512Z", + "shell.execute_reply": "2026-05-04T20:25:45.660236Z" + } + }, + "outputs": [], + "source": [ + "# Add sample conversation: weather in Seattle → booking a trip (6 turns)\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", + " content=\"What's the weather like in Seattle this weekend?\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", + " content=\"This weekend Seattle will be around 55°F with partly cloudy skies on Saturday and light rain expected Sunday.\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", + " content=\"That sounds nice enough. Can you help me book a trip to Seattle for this weekend?\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", + " content=\"Sure! I found round-trip flights departing Friday evening and returning Sunday night. There are also several hotels in downtown Seattle with availability. Would you like me to look at specific airlines or neighborhoods?\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", + " content=\"Something near Pike Place Market would be great. And keep the flights under $300 round trip if possible.\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", + " content=\"I found a round-trip on Alaska Airlines for $275 and two hotel options within a 5-minute walk of Pike Place Market: the Inn at the Market ($189/night) and a Hilton Garden Inn ($145/night). Want me to reserve one of these?\",\n", + ")\n", + "\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", + " content=\"Whenever you book a flight for me, always book an aisle seat — never a window or middle.\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", + " content=\"Got it. I'll always select an aisle seat for your bookings.\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", + " content=\"For trip planning, my workflow is: first check the weather for the destination, then check flights, then book the hotel last after everything else is confirmed.\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", + " content=\"Noted — I'll follow that order: weather, then flights, then hotel.\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"user\", thread_id=THREAD_ID,\n", + " content=\"And never book me into anything that departs or arrives between midnight and 6am unless I explicitly approve it.\",\n", + ")\n", + "memory.add_local(\n", + " user_id=USER_ID, role=\"agent\", thread_id=THREAD_ID,\n", + " content=\"Will do — no overnight bookings without your explicit approval.\",\n", + ")\n", + "\n", + "print(f\"Added {len(memory.local_memory)} memories\")\n", + "print(json.dumps(memory.get_local(), indent=2))\n", + "\n", + "# A second short thread of pure procedural-style instructions. Demonstrates\n", + "# that the extractor produces clean procedural items when the conversation is\n", + "# focused on rules/workflows rather than mixed with factual booking specifics.\n", + "RULES_THREAD_ID = str(uuid.uuid4())\n", + "for role, content in [\n", + " (\"user\", \"Whenever you book a flight for me, always book an aisle seat — never a window or middle.\"),\n", + " (\"agent\", \"Got it. I'll always select an aisle seat for your bookings.\"),\n", + " (\"user\", \"For trip planning, my workflow is: first check the weather, then check flights, and book the hotel last after everything else is confirmed.\"),\n", + " (\"agent\", \"Noted — I'll follow that order: weather, then flights, then hotel.\"),\n", + " (\"user\", \"Never book me into anything that departs or arrives between midnight and 6am unless I explicitly approve it.\"),\n", + " (\"agent\", \"Will do — no overnight bookings without your explicit approval.\"),\n", + " (\"user\", \"When picking a hotel, only recommend ones that include complimentary breakfast.\"),\n", + " (\"agent\", \"Understood — only hotels with complimentary breakfast.\"),\n", + "]:\n", + " memory.add_local(user_id=USER_ID, role=role, thread_id=RULES_THREAD_ID, content=content)\n", + "\n", + "print(f\"Rules thread ID: {RULES_THREAD_ID} ({sum(1 for m in memory.local_memory if m['thread_id']==RULES_THREAD_ID)} turns)\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "9a0aac22", + "metadata": {}, + "source": [ + "### 2b. Query memories with `get_local`" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "942e3714", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:06:50.682868Z", + "start_time": "2026-04-07T22:06:50.661470Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:25:45.661416Z", + "iopub.status.busy": "2026-05-04T20:25:45.661371Z", + "iopub.status.idle": "2026-05-04T20:25:45.663639Z", + "shell.execute_reply": "2026-05-04T20:25:45.663296Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total memories: 19\n", + "\n", + "Memories for user-68421be1: 19\n", + "Agent memories: 10\n", + " [4d27c469...] This weekend Seattle will be around 55°F with partly cloudy \n", + " [5991e394...] Sure! I found round-trip flights departing Friday evening an\n", + " [ae314a6e...] I found a round-trip on Alaska Airlines for $275 and two hot\n", + " [bc5681e4...] Got it. I'll always select an aisle seat for your bookings.\n", + " [eccd2557...] Noted — I'll follow that order: weather, then flights, then \n", + " [d2109708...] Will do — no overnight bookings without your explicit approv\n", + " [f0fd3216...] Got it. I'll always select an aisle seat for your bookings.\n", + " [d90de470...] Noted — I'll follow that order: weather, then flights, then \n", + " [5156acad...] Will do — no overnight bookings without your explicit approv\n", + " [5ba8a11c...] Understood — only hotels with complimentary breakfast.\n", + "\n", + "Fact memories: 0\n", + "\n", + "Agent memories for user-68421be1: 10\n" + ] + } + ], + "source": [ + "# Get all memories\n", + "all_memories = memory.get_local()\n", + "print(f\"Total memories: {len(all_memories)}\\n\")\n", + "\n", + "# Filter by user_id\n", + "user_memories = memory.get_local(user_id=USER_ID)\n", + "print(f\"Memories for {USER_ID}: {len(user_memories)}\")\n", + "\n", + "# Filter by role\n", + "agent_memories = memory.get_local(role=\"agent\")\n", + "print(f\"Agent memories: {len(agent_memories)}\")\n", + "for m in agent_memories:\n", + " print(f\" [{m['id'][:8]}...] {m['content'][:60]}\")\n", + "\n", + "# Filter by type\n", + "facts = memory.get_local(memory_types=[\"fact\"])\n", + "print(f\"\\nFact memories: {len(facts)}\")\n", + "for m in facts:\n", + " print(f\" [{m['id'][:8]}...] {m['content']}\")\n", + "\n", + "# Combine filters: current user + agent role\n", + "user_agent_memories = memory.get_local(user_id=USER_ID, role=\"agent\")\n", + "print(f\"\\nAgent memories for {USER_ID}: {len(user_agent_memories)}\")" + ] + }, + { + "cell_type": "markdown", + "id": "ba973a1c", + "metadata": {}, + "source": [ + "### 2c. Update & Delete with `update_local` / `delete_local`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4ca36086", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:06:53.605394Z", + "start_time": "2026-04-07T22:06:53.576655Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:25:45.664504Z", + "iopub.status.busy": "2026-05-04T20:25:45.664457Z", + "iopub.status.idle": "2026-05-04T20:25:45.666846Z", + "shell.execute_reply": "2026-05-04T20:25:45.666497Z" + } + }, + "outputs": [], + "source": [ + "# Update the user's budget constraint to be more specific\n", + "target_id = memory.local_memory[4][\"id\"] # \"Something near Pike Place Market...\"\n", + "print(f\"Before update:\\n{json.dumps(memory.get_local(memory_id=target_id)[0], indent=2)}\\n\")\n", + "\n", + "memory.update_local(\n", + " memory_id=target_id,\n", + " content=\"Something near Pike Place Market would be great. Keep flights under $300 round trip and hotels under $200/night.\",\n", + " metadata={\"edited\": True, \"reason\": \"user clarified hotel budget\"},\n", + ")\n", + "print(f\"After update:\\n{json.dumps(memory.get_local(memory_id=target_id)[0], indent=2)}\")\n", + "\n", + "# Delete the third memory (index 2 — the user's booking request)\n", + "del_target_id = memory.local_memory[2][\"id\"]\n", + "print(f\"\\nDeleting memory {del_target_id[:8]}...\")\n", + "memory.delete_local(del_target_id)\n", + "\n", + "# Verify it's gone\n", + "print(f\"\\nRemaining memories: {len(memory.get_local())}\")\n", + "for m in memory.get_local():\n", + " print(f\" [{m['thread_id'][:8]}...] [{m['id'][:8]}...] role={m['role']:<6} type={m['type']:<8} {m['content'][:50]}\")" + ] + }, + { + "cell_type": "markdown", + "id": "bad8c2b6", + "metadata": {}, + "source": [ + "## 3. Cosmos DB Operations\n", + "\n", + "### 3a. Connect and create the memory store\n", + "\n", + "The async client auto-connects on the first Cosmos DB operation. Call `create_memory_store()` to create the database and container if they do not already exist, including the hierarchical partition key, vector index, and full-text index.\n", + "\n", + "> **Note:** `create_memory_store()` is safe to run more than once." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "82b363d7", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:06:58.478498Z", + "start_time": "2026-04-07T22:06:57.474753Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:25:45.667704Z", + "iopub.status.busy": "2026-05-04T20:25:45.667661Z", + "iopub.status.idle": "2026-05-04T20:25:46.372667Z", + "shell.execute_reply": "2026-05-04T20:25:46.371834Z" + } + }, + "outputs": [], + "source": [ + "# The async client auto-creates the database and container on the first Cosmos operation.\n", + "# You can also call create_memory_store() explicitly if needed.\n", + "await memory.create_memory_store()\n", + "print(f\"Connected: {memory._container_client is not None}\")" + ] + }, + { + "cell_type": "markdown", + "id": "5c18edf3", + "metadata": {}, + "source": [ + "### 3b. Add memories to Cosmos DB with `add_cosmos`" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b7d0939d", + "metadata": { + "execution": { + "iopub.execute_input": "2026-05-04T20:25:46.375244Z", + "iopub.status.busy": "2026-05-04T20:25:46.375091Z", + "iopub.status.idle": "2026-05-04T20:25:46.627003Z", + "shell.execute_reply": "2026-05-04T20:25:46.626193Z" + } + }, + "outputs": [], + "source": [ + "await memory.connect_cosmos()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e0b3b5fc", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:07:08.081103Z", + "start_time": "2026-04-07T22:07:07.860764Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:25:46.629264Z", + "iopub.status.busy": "2026-05-04T20:25:46.629134Z", + "iopub.status.idle": "2026-05-04T20:25:47.111769Z", + "shell.execute_reply": "2026-05-04T20:25:47.111092Z" + } + }, + "outputs": [], + "source": [ + "await memory.push_to_cosmos()\n", + "\n", + "# Push a new thread directly to Cosmos DB without adding to local memory first\n", + "new_thread_id = str(uuid.uuid4())\n", + "print(f\"New Thread ID: {new_thread_id}\\n\")\n", + "\n", + "# Add memories directly to Cosmos DB using add_cosmos\n", + "await memory.add_cosmos(\n", + " user_id=\"user-002\", role=\"user\", thread_id=new_thread_id,\n", + " content=\"Can you recommend some good restaurants in New York City?\",\n", + ")\n", + "await memory.add_cosmos(\n", + " user_id=\"user-002\", role=\"tool\", thread_id=new_thread_id,\n", + " content='{\"query\": \"top restaurants NYC\", \"results\": [\"Carbone\", \"Nobu\", \"Katz\\'s Deli\", \"Le Bernardin\"]}',\n", + " metadata={\"tool_name\": \"restaurant_search\", \"tool_call_id\": \"call_abc123\"},\n", + ")\n", + "await memory.add_cosmos(\n", + " user_id=\"user-002\", role=\"agent\", thread_id=new_thread_id,\n", + " content=\"Absolutely! NYC has incredible dining options. For Italian, try Carbone in Greenwich Village. For sushi, Nobu in Tribeca is world-class. For a classic NYC experience, Katz's Delicatessen on the Lower East Side is a must.\",\n", + ")\n", + "await memory.add_cosmos(\n", + " user_id=\"user-002\", role=\"user\", thread_id=new_thread_id,\n", + " content=\"I love Italian food. Are there any options that are budget-friendly?\",\n", + ")\n", + "await memory.add_cosmos(\n", + " user_id=\"user-002\", role=\"agent\", thread_id=new_thread_id,\n", + " content=\"For budget-friendly Italian in NYC, check out L'industrie Pizzeria in Williamsburg or Artichoke Basille's Pizza. Both are highly rated and won't break the bank.\",\n", + ")\n", + "\n", + "# Verify the memories were added directly to Cosmos DB (not in local memory)\n", + "print(f\"Local memory count (should be unchanged): {len(memory.local_memory)}\\n\")\n", + "\n", + "cosmos_results = await memory.get_memories(user_id=\"user-002\", thread_id=new_thread_id)\n", + "print(f\"Memories in Cosmos DB for new thread: {len(cosmos_results)}\")\n", + "for r in cosmos_results:\n", + " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} {r['content'][:60]}\")" + ] + }, + { + "cell_type": "markdown", + "id": "b04679dd", + "metadata": {}, + "source": [ + "### 3c. Retrieve memories from Cosmos DB with `get_memories`\n", + "\n", + "Supports the same filters as `get_local`: `memory_id`, `user_id`, `role`, `memory_type`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a13b2301", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:07:11.561128Z", + "start_time": "2026-04-07T22:07:11.474440Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:25:47.113447Z", + "iopub.status.busy": "2026-05-04T20:25:47.113322Z", + "iopub.status.idle": "2026-05-04T20:25:47.262048Z", + "shell.execute_reply": "2026-05-04T20:25:47.260997Z" + } + }, + "outputs": [], + "source": [ + "# Get all memories for the current demo user\n", + "results = await memory.get_memories(user_id=USER_ID)\n", + "print(f\"Memories for {USER_ID}: {len(results)}\\n\")\n", + "for r in results:\n", + " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} type={r['type']:<8} {r['content'][:50]}\")\n", + "\n", + "# Get only agent memories\n", + "agent_results = await memory.get_memories(role=\"agent\")\n", + "print(f\"\\nAgent memories: {len(agent_results)}\")\n", + "for r in agent_results:\n", + " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} type={r['type']:<8} {r['content'][:50]}\")" + ] + }, + { + "cell_type": "markdown", + "id": "7e98a7c2", + "metadata": {}, + "source": [ + "### 3d. Update & Delete in Cosmos DB\n", + "\n", + "If the content changes, the embedding is automatically re-generated (awaited)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b0b61df9", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:07:16.784062Z", + "start_time": "2026-04-07T22:07:16.651689Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:25:47.264618Z", + "iopub.status.busy": "2026-05-04T20:25:47.264449Z", + "iopub.status.idle": "2026-05-04T20:25:47.395572Z", + "shell.execute_reply": "2026-05-04T20:25:47.394909Z" + } + }, + "outputs": [], + "source": [ + "# Update the user's budget message to add a hotel budget constraint\n", + "user_msgs = await memory.get_memories(user_id=USER_ID, role=\"user\")\n", + "target = [m for m in user_msgs if \"Pike Place\" in m[\"content\"]][0]\n", + "print(f\"Before: {target['content']}\\n\")\n", + "\n", + "await memory.update_cosmos(\n", + " memory_id=target[\"id\"],\n", + " content=\"Something near Pike Place Market would be great. Keep flights under $300 round trip and hotels under $200/night.\",\n", + " metadata={\"edited\": True, \"reason\": \"user clarified hotel budget\"},\n", + ")\n", + "\n", + "updated = (await memory.get_memories(memory_id=target[\"id\"]))[0]\n", + "print(f\"After: {updated['content']}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "74874763", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:07:36.933417Z", + "start_time": "2026-04-07T22:07:36.641107Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:25:47.397837Z", + "iopub.status.busy": "2026-05-04T20:25:47.397690Z", + "iopub.status.idle": "2026-05-04T20:25:50.012907Z", + "shell.execute_reply": "2026-05-04T20:25:50.012517Z" + } + }, + "outputs": [], + "source": [ + "# Delete the tool memory from Cosmos (async)\n", + "tool_mems = await memory.get_memories(user_id=\"user-002\", role=\"tool\")\n", + "print(tool_mems[0])\n", + "if tool_mems:\n", + " await memory.delete_cosmos(\n", + " tool_mems[0][\"id\"],\n", + " thread_id=tool_mems[0][\"thread_id\"],\n", + " user_id=tool_mems[0][\"user_id\"],\n", + " )\n", + " print(f\"Deleted tool memory {tool_mems[0]['id'][:8]}...\")\n", + "\n", + "# Verify\n", + "remaining = await memory.get_memories()\n", + "print(f\"\\nRemaining memories in Cosmos DB: {len(remaining)}\")\n", + "for r in remaining:\n", + " print(f\" [{r['thread_id'][:8]}...] [{r['id'][:8]}...] role={r['role']:<6} type={r['type']:<8} {r['content'][:50]}\")" + ] + }, + { + "cell_type": "markdown", + "id": "007708d5", + "metadata": {}, + "source": [ + "### 3e. Retrieve a full thread with `get_thread`\n", + "\n", + "Same parameters: `thread_id` (required), `user_id` (optional), `recent_k` (optional)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3ed613d3", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:07:40.340577Z", + "start_time": "2026-04-07T22:07:40.138825Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:25:50.014174Z", + "iopub.status.busy": "2026-05-04T20:25:50.014096Z", + "iopub.status.idle": "2026-05-04T20:25:50.246063Z", + "shell.execute_reply": "2026-05-04T20:25:50.245174Z" + } + }, + "outputs": [], + "source": [ + "# Use the CURRENT seed thread (from cell 5) so we operate on the data we just wrote.\n", + "thread_id = THREAD_ID\n", + "print(f\"Using thread_id: {thread_id}\\n\")\n", + "\n", + "# Get all documents in the thread\n", + "thread_all = await memory.get_thread(thread_id=thread_id)\n", + "print(f\"All memories in thread: {len(thread_all)}\")\n", + "for m in thread_all:\n", + " print(f\" [{m['thread_id'][:8]}...] [{m['id'][:8]}...] role={m.get('role','?'):6} type={m['type']:8} {m['content'][:60]}\")\n", + "\n", + "recent = await memory.get_thread(thread_id=thread_id, recent_k=2)\n", + "print(f\"\\nMost recent 2 memories:\")\n", + "for m in recent:\n", + " print(f\" [{m['thread_id'][:8]}...] [{m['id'][:8]}...] role={m.get('role','?'):6} type={m['type']:8} {m['content'][:60]}\")\n", + "\n", + "thread_user = await memory.get_thread(thread_id=thread_id, user_id=USER_ID)\n", + "print(f\"\\nThread memories for {USER_ID}: {len(thread_user)}\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "06a9f99d", + "metadata": {}, + "source": [ + "## 4. Thread Summary (in-process)\n", + "\n", + "`AsyncCosmosMemoryClient.generate_thread_summary()` runs the summarisation pipeline **in-process** — no Azure Functions required. The async client uses the AI Foundry async openai client and the async Cosmos SDK, so calls don't block the event loop.\n", + "\n", + "If a prior summary exists, the call performs an **incremental update** that preserves the metadata-tracked `source_count`.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9bc68919", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:08:08.478793Z", + "start_time": "2026-04-07T22:07:45.385054Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:25:50.247941Z", + "iopub.status.busy": "2026-05-04T20:25:50.247791Z", + "iopub.status.idle": "2026-05-04T20:26:03.871259Z", + "shell.execute_reply": "2026-05-04T20:26:03.870396Z" + } + }, + "outputs": [], + "source": [ + "thread_id = THREAD_ID\n", + "user_id = USER_ID\n", + "print(f\"Summarizing thread_id={thread_id} user_id={user_id}\\n\")\n", + "\n", + "summary_doc = await memory.generate_thread_summary(user_id=user_id, thread_id=thread_id)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "da4cba4f", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:08:13.446032Z", + "start_time": "2026-04-07T22:08:13.390800Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:03.875835Z", + "iopub.status.busy": "2026-05-04T20:26:03.875663Z", + "iopub.status.idle": "2026-05-04T20:26:03.879262Z", + "shell.execute_reply": "2026-05-04T20:26:03.878646Z" + } + }, + "outputs": [], + "source": [ + "print(\"Summary document:\")\n", + "print(f\" id: {summary_doc['id']}\")\n", + "print(f\" content: {summary_doc['content'][:200]}...\")\n", + "print(f\" source_count: {summary_doc.get('metadata', {}).get('source_count')}\")\n", + "print(f\" embedding length: {len(summary_doc.get('embedding', []))}\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "3cd2e4f8", + "metadata": {}, + "source": [ + "## 5. Memory Extraction (facts + episodic + procedural)\n", + "\n", + "`extract_memories()` runs a single LLM call that produces three structured memory types:\n", + "\n", + "| Type | Description |\n", + "|--------------|--------------------------------------------------------------------------|\n", + "| `fact` | Stable, atomic facts about the user. |\n", + "| `episodic` | Discrete past events the user described. |\n", + "| `procedural` | How-to guidance the agent should follow. |\n", + "\n", + "Each derived memory is embedded and stored in Cosmos DB with auto-generated tags and a salience score.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e4d57e2d", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:08:23.444563Z", + "start_time": "2026-04-07T22:08:17.255145Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:03.881644Z", + "iopub.status.busy": "2026-05-04T20:26:03.881553Z", + "iopub.status.idle": "2026-05-04T20:26:11.858903Z", + "shell.execute_reply": "2026-05-04T20:26:11.857972Z" + } + }, + "outputs": [], + "source": [ + "# Extract memories from both the SEED and the pure-procedural RULES thread.\n", + "result_main = await memory.extract_memories(user_id=USER_ID, thread_id=THREAD_ID)\n", + "print(\"Seed thread extraction:\", result_main)\n", + "\n", + "result_rules = await memory.extract_memories(user_id=USER_ID, thread_id=RULES_THREAD_ID)\n", + "print(\"Rules thread extraction:\", result_rules)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "795e8634", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:08:26.904418Z", + "start_time": "2026-04-07T22:08:26.587707Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:11.861697Z", + "iopub.status.busy": "2026-05-04T20:26:11.861551Z", + "iopub.status.idle": "2026-05-04T20:26:12.283813Z", + "shell.execute_reply": "2026-05-04T20:26:12.283042Z" + } + }, + "outputs": [], + "source": [ + "# Inspect the persisted derived memories across BOTH threads for this user.\n", + "for mt in (\"fact\", \"episodic\", \"procedural\"):\n", + " docs = await memory.get_memories(user_id=USER_ID, memory_types=[mt])\n", + " print(f\"\\n{mt.upper()}S ({len(docs)}):\")\n", + " for d in docs:\n", + " print(f\" • {d['content'][:100]} [salience={d.get('salience')}]\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "3ad14e69", + "metadata": {}, + "source": [ + "## 6. User Summary (cross-thread profile)\n", + "\n", + "`generate_user_summary()` aggregates memories **across all threads** for a user and produces a structured profile (preferences, account state, behavioural patterns, …). The result is stored in Cosmos DB with `type: \"user_summary\"`.\n", + "\n", + "Retrieve the latest stored profile at any time with `get_user_summary(user_id)`.\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cbd3806f", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:08:37.628678Z", + "start_time": "2026-04-07T22:08:29.322243Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:12.285934Z", + "iopub.status.busy": "2026-05-04T20:26:12.285802Z", + "iopub.status.idle": "2026-05-04T20:26:22.526266Z", + "shell.execute_reply": "2026-05-04T20:26:22.525613Z" + } + }, + "outputs": [], + "source": [ + "# Generate a user-level summary across all threads.\n", + "user_summary_doc = await memory.generate_user_summary(user_id=user_id)\n", + "print(\"User summary id:\", user_summary_doc[\"id\"])\n", + "print(\"\\nContent:\\n\", user_summary_doc[\"content\"][:600], \"...\")\n", + "print(\"\\nStructured profile keys:\", list(user_summary_doc.get(\"metadata\", {}).get(\"structured_summary\", {}).keys()))\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "97ddc94f", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:08:39.653532Z", + "start_time": "2026-04-07T22:08:39.229659Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:22.528078Z", + "iopub.status.busy": "2026-05-04T20:26:22.527959Z", + "iopub.status.idle": "2026-05-04T20:26:22.618478Z", + "shell.execute_reply": "2026-05-04T20:26:22.618055Z" + } + }, + "outputs": [], + "source": [ + "# Retrieve the stored user summary from Cosmos DB (async)\n", + "stored = await memory.get_user_summary(user_id=user_id)\n", + "if stored:\n", + " print(\"User Summary for\", user_id)\n", + " print(stored[\"content\"])\n", + "else:\n", + " print(\"No user summary found — run the generate_user_summary cell first.\")\n" + ] + }, + { + "cell_type": "markdown", + "id": "92e5d32b", + "metadata": {}, + "source": [ + "### 7. Vector search with `search_cosmos`\n", + "\n", + "Same as the sync version — embeds the query and runs a `VectorDistance` similarity search." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "af4afa77", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:08:46.028010Z", + "start_time": "2026-04-07T22:08:43.195430Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:22.619506Z", + "iopub.status.busy": "2026-05-04T20:26:22.619453Z", + "iopub.status.idle": "2026-05-04T20:26:24.825313Z", + "shell.execute_reply": "2026-05-04T20:26:24.824663Z" + } + }, + "outputs": [], + "source": [ + "results_search_async = await memory.search_cosmos(\n", + " search_terms=\"What did the user ask about the weather?\",\n", + " user_id=USER_ID,\n", + " top_k=3, hybrid_search= True\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c0471fd4", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:08:47.537201Z", + "start_time": "2026-04-07T22:08:47.500038Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:24.827496Z", + "iopub.status.busy": "2026-05-04T20:26:24.827365Z", + "iopub.status.idle": "2026-05-04T20:26:24.830446Z", + "shell.execute_reply": "2026-05-04T20:26:24.829891Z" + } + }, + "outputs": [], + "source": [ + "print(f\"Top {len(results_search_async)} results:\\n\")\n", + "for r in results_search_async:\n", + " score = r.get(\"score\", \"N/A\")\n", + " print(f\" [{r['id'][:8]}...] score={score} {r['content'][:60]}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bb4cc8f8", + "metadata": { + "ExecuteTime": { + "end_time": "2026-04-07T22:08:49.434405Z", + "start_time": "2026-04-07T22:08:49.164046Z" + }, + "execution": { + "iopub.execute_input": "2026-05-04T20:26:24.831979Z", + "iopub.status.busy": "2026-05-04T20:26:24.831863Z", + "iopub.status.idle": "2026-05-04T20:26:24.835490Z", + "shell.execute_reply": "2026-05-04T20:26:24.834936Z" + } + }, + "outputs": [], + "source": [ + "# Clean up async clients when done\n", + "await memory.close()\n", + "print(\"Async clients closed.\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "py314", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.14.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/Samples/Demo_function_app.ipynb b/Samples/Notebooks/Demo_function_app.ipynb similarity index 61% rename from Samples/Demo_function_app.ipynb rename to Samples/Notebooks/Demo_function_app.ipynb index b5508b8..7a5b27a 100644 --- a/Samples/Demo_function_app.ipynb +++ b/Samples/Notebooks/Demo_function_app.ipynb @@ -46,7 +46,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "511a80a6", "metadata": { "execution": { @@ -56,18 +56,7 @@ "shell.execute_reply": "2026-05-04T20:24:03.977906Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Cosmos endpoint : https://akataria-agent-memory-testing.documents.azure.com:443/\n", - "AI Foundry : https://akataria-testing.openai.azure.com/\n", - "Chat deployment : gpt-5.2-chat\n", - "Embed deployment: text-embedding-3-large\n" - ] - } - ], + "outputs": [], "source": [ "import os, time, uuid\n", "from dotenv import load_dotenv\n", @@ -96,7 +85,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "d27a2c9c", "metadata": { "execution": { @@ -106,15 +95,7 @@ "shell.execute_reply": "2026-05-04T20:24:04.642682Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Processor: DurableFunctionProcessor\n" - ] - } - ], + "outputs": [], "source": [ "memory = CosmosMemoryClient(\n", " cosmos_endpoint=os.environ[\"COSMOS_DB_ENDPOINT\"],\n", @@ -143,7 +124,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "c9cc81dc", "metadata": { "execution": { @@ -153,32 +134,7 @@ "shell.execute_reply": "2026-05-04T20:24:04.912194Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "USER_ID = fa-demo-8c79094e\n", - "THREAD_ID = bdd72079-d6b6-4391-9c75-7269dda2998d\n", - " wrote user: What's the weather like in Seattle this weekend?\n", - " wrote agent: Around 55°F with partly cloudy skies on Saturday and light r…\n", - " wrote user: Can you book me a weekend trip there? Flights under $300, ho…\n", - " wrote agent: I found a $275 Alaska Airlines round-trip and a $185/night h…\n", - " wrote user: Whenever you book a flight for me, always book an aisle seat…\n", - " wrote agent: Got it — aisle seats only.\n", - " wrote user: For trip planning, my workflow is: first weather, then fligh…\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - " wrote agent: Noted — weather → flights → hotel.\n", - " wrote user: Never book me into anything between midnight and 6am unless …\n", - " wrote agent: Understood — no overnight bookings without your approval.\n" - ] - } - ], + "outputs": [], "source": [ "USER_ID = f\"fa-demo-{uuid.uuid4().hex[:8]}\"\n", "THREAD_ID = str(uuid.uuid4())\n", @@ -221,7 +177,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "c38a937f", "metadata": { "execution": { @@ -231,15 +187,7 @@ "shell.execute_reply": "2026-05-04T20:24:04.937272Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "process_now() returned — no LLM call was made by the SDK.\n" - ] - } - ], + "outputs": [], "source": [ "# No-op: the function app owns processing.\n", "memory.process_now(user_id=USER_ID, thread_id=THREAD_ID)\n", @@ -264,7 +212,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "90c5fffa", "metadata": { "execution": { @@ -274,183 +222,7 @@ "shell.execute_reply": "2026-05-04T20:24:17.438216Z" } }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Polling Cosmos for the auto-generated summary…\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Summary available: True\n" - ] - } - ], + "outputs": [], "source": [ "print(\"Polling Cosmos for the auto-generated summary…\")\n", "ok = memory.process_now_and_wait(user_id=USER_ID, thread_id=THREAD_ID, timeout=120.0)\n", @@ -477,7 +249,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "46f36b92", "metadata": { "execution": { @@ -487,104 +259,7 @@ "shell.execute_reply": "2026-05-04T20:24:32.880948Z" } }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Initial state:\n", - "\n", - "SUMMARYS (1):\n", - " • [summary_fa-demo-8c79094e_bdd7207…] The conversation centered on planning a potential weekend trip to Seattle, including check\n", - "\n", - "FACTS (0):\n", - "\n", - "EPISODICS (0):\n", - "\n", - "PROCEDURALS (0):\n", - "\n", - "USER_SUMMARYS (1):\n", - " • [user_summary_fa-demo-8c79094e…] {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \"The user requires aisle seats for al\n", - "\n", - "... fact / procedural extraction still in flight (attempt 1/6, sleeping 15s)\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "=== Final state ===\n", - "\n", - "SUMMARYS (1):\n", - " • [summary_fa-demo-8c79094e_bdd7207…] The conversation centered on planning a potential weekend trip to Seattle, including check\n", - "\n", - "FACTS (1):\n", - " • [fact_18e3eabd2cc357de…] The user requires flights under $300 and hotels under $200 per night when booking weekend \n", - "\n", - "EPISODICS (0):\n", - "\n", - "PROCEDURALS (3):\n", - " • [proc_3528178c5609b42d…] Always book an aisle seat when reserving flights for the user.\n", - " • [proc_df7a5492c27604d9…] Follow the sequence: check weather first, then book flights, then book hotel when planning\n", - " • [proc_a79f02cc308d597b…] Never book flights, hotels, or other travel arrangements between midnight and 6am unless t\n", - "\n", - "USER_SUMMARYS (1):\n", - " • [user_summary_fa-demo-8c79094e…] {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \"The user requires aisle seats for al\n" - ] - }, - { - "data": { - "text/plain": [ - "{'summary': 1, 'fact': 1, 'episodic': 0, 'procedural': 3, 'user_summary': 1}" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# All derived memories for this user, written by the function app.\n", "# Fact / episodic / procedural extraction runs in a separate orchestrator that\n", diff --git a/Samples/Demo_function_app_async.ipynb b/Samples/Notebooks/Demo_function_app_async.ipynb similarity index 51% rename from Samples/Demo_function_app_async.ipynb rename to Samples/Notebooks/Demo_function_app_async.ipynb index 37a2a56..a3db905 100644 --- a/Samples/Demo_function_app_async.ipynb +++ b/Samples/Notebooks/Demo_function_app_async.ipynb @@ -24,7 +24,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "7bcb4168", "metadata": { "execution": { @@ -34,16 +34,7 @@ "shell.execute_reply": "2026-05-04T20:24:34.110918Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Cosmos endpoint : https://akataria-agent-memory-testing.documents.azure.com:443/\n", - "AI Foundry : https://akataria-testing.openai.azure.com/\n" - ] - } - ], + "outputs": [], "source": [ "import os, uuid\n", "from dotenv import load_dotenv\n", @@ -66,7 +57,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "6fdcee9d", "metadata": { "execution": { @@ -76,15 +67,7 @@ "shell.execute_reply": "2026-05-04T20:24:34.831510Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Processor: AsyncDurableFunctionProcessor\n" - ] - } - ], + "outputs": [], "source": [ "memory = AsyncCosmosMemoryClient(\n", " cosmos_endpoint=os.environ[\"COSMOS_DB_ENDPOINT\"],\n", @@ -110,7 +93,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "2d159625", "metadata": { "execution": { @@ -120,38 +103,7 @@ "shell.execute_reply": "2026-05-04T20:24:35.326937Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "USER_ID = fa-demo-29acad58\n", - "THREAD_ID = 42b91b2c-96a2-43fb-94cb-2c941d654d53\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - " wrote user: What's the weather like in Seattle this weekend?\n", - " wrote agent: Around 55°F with partly cloudy skies on Saturday and light r…\n", - " wrote user: Can you book me a weekend trip there? Flights under $300, ho…\n", - " wrote agent: I found a $275 Alaska Airlines round-trip and a $185/night h…\n", - " wrote user: Whenever you book a flight for me, always book an aisle seat…\n", - " wrote agent: Got it — aisle seats only.\n", - " wrote user: For trip planning, my workflow is: first weather, then fligh…\n", - " wrote agent: Noted — weather → flights → hotel.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - " wrote user: Never book me into anything between midnight and 6am unless …\n", - " wrote agent: Understood — no overnight bookings without your approval.\n" - ] - } - ], + "outputs": [], "source": [ "USER_ID = f\"fa-demo-{uuid.uuid4().hex[:8]}\"\n", "THREAD_ID = str(uuid.uuid4())\n", @@ -191,7 +143,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "3a44c396", "metadata": { "execution": { @@ -201,15 +153,7 @@ "shell.execute_reply": "2026-05-04T20:24:35.370546Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "process_now() returned — no LLM call was made by the SDK.\n" - ] - } - ], + "outputs": [], "source": [ "await memory.process_now(user_id=USER_ID, thread_id=THREAD_ID)\n", "print(\"process_now() returned — no LLM call was made by the SDK.\")" @@ -225,7 +169,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "133d9f38", "metadata": { "execution": { @@ -235,176 +179,7 @@ "shell.execute_reply": "2026-05-04T20:24:47.003082Z" } }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Polling Cosmos for the auto-generated summary…\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Summary available: True\n" - ] - } - ], + "outputs": [], "source": [ "print(\"Polling Cosmos for the auto-generated summary…\")\n", "ok = await memory.process_now_and_wait(user_id=USER_ID, thread_id=THREAD_ID, timeout=120.0)\n", @@ -421,7 +196,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "d631f418", "metadata": { "execution": { @@ -431,105 +206,7 @@ "shell.execute_reply": "2026-05-04T20:25:02.625165Z" } }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Initial state:\n", - "\n", - "SUMMARYS (1):\n", - " • [summary_fa-demo-29acad58_42b91b2…] The user inquired about a weekend trip to Seattle, including weather, flights, and hotel o\n", - "\n", - "FACTS (0):\n", - "\n", - "EPISODICS (0):\n", - "\n", - "PROCEDURALS (0):\n", - "\n", - "USER_SUMMARYS (1):\n", - " • [user_summary_fa-demo-29acad58…] {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \"The user requires aisle seats for al\n", - "\n", - "... fact / procedural extraction still in flight (attempt 1/6, sleeping 15s)\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "get_memories returned empty results\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "=== Final state ===\n", - "\n", - "SUMMARYS (1):\n", - " • [summary_fa-demo-29acad58_42b91b2…] The user inquired about a weekend trip to Seattle, including weather, flights, and hotel o\n", - "\n", - "FACTS (2):\n", - " • [fact_95d8f914106e4285…] The user requested booking a weekend trip to Seattle with flights under $300 and a hotel u\n", - " • [fact_81e062e9c31b6ba9…] The user requires flights to cost under $300 and hotels to cost under $200 per night when \n", - "\n", - "EPISODICS (0):\n", - "\n", - "PROCEDURALS (3):\n", - " • [proc_d8982eeda8162663…] Always book an aisle seat and never book a window or middle seat when reserving flights fo\n", - " • [proc_5ed4511bdf64af74…] Follow the sequence weather first, then flights, then hotel when planning trips for the us\n", - " • [proc_afb2890b8a68432f…] Never book flights or accommodations between midnight and 6am unless the user explicitly a\n", - "\n", - "USER_SUMMARYS (1):\n", - " • [user_summary_fa-demo-29acad58…] {\n", - " \"key_facts\": [],\n", - " \"personal_preferences\": [\n", - " \"The user requires aisle seats for al\n" - ] - }, - { - "data": { - "text/plain": [ - "{'summary': 1, 'fact': 2, 'episodic': 0, 'procedural': 3, 'user_summary': 1}" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# All derived memories for this user, written by the function app (async).\n", "import asyncio\n", @@ -571,7 +248,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "14372923", "metadata": { "execution": { @@ -581,15 +258,7 @@ "shell.execute_reply": "2026-05-04T20:25:02.631106Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Async client closed.\n" - ] - } - ], + "outputs": [], "source": [ "await memory.close()\n", "print(\"Async client closed.\")" diff --git a/Samples/processing_fact_extraction.py b/Samples/Processing/processing_fact_extraction.py similarity index 100% rename from Samples/processing_fact_extraction.py rename to Samples/Processing/processing_fact_extraction.py diff --git a/Samples/processing_thread_summary.py b/Samples/Processing/processing_thread_summary.py similarity index 100% rename from Samples/processing_thread_summary.py rename to Samples/Processing/processing_thread_summary.py diff --git a/Samples/processing_user_profile.py b/Samples/Processing/processing_user_profile.py similarity index 100% rename from Samples/processing_user_profile.py rename to Samples/Processing/processing_user_profile.py diff --git a/Samples/quickstart_cosmos.py b/Samples/Quickstarts/quickstart_cosmos.py similarity index 100% rename from Samples/quickstart_cosmos.py rename to Samples/Quickstarts/quickstart_cosmos.py diff --git a/Samples/quickstart_local.py b/Samples/Quickstarts/quickstart_local.py similarity index 96% rename from Samples/quickstart_local.py rename to Samples/Quickstarts/quickstart_local.py index c52ab09..9d61924 100644 --- a/Samples/quickstart_local.py +++ b/Samples/Quickstarts/quickstart_local.py @@ -1,7 +1,7 @@ """Quickstart: local-only CosmosMemoryClient demo (no cloud credentials needed). Run with: - python Samples/quickstart_local.py + python Samples/Quickstarts/quickstart_local.py """ from agent_memory_toolkit import CosmosMemoryClient diff --git a/Samples/scenario_chat_memory.py b/Samples/Scenarios/scenario_chat_memory.py similarity index 100% rename from Samples/scenario_chat_memory.py rename to Samples/Scenarios/scenario_chat_memory.py diff --git a/Samples/scenario_counter_tuning.py b/Samples/Scenarios/scenario_counter_tuning.py similarity index 100% rename from Samples/scenario_counter_tuning.py rename to Samples/Scenarios/scenario_counter_tuning.py diff --git a/Samples/scenario_customer_support.py b/Samples/Scenarios/scenario_customer_support.py similarity index 100% rename from Samples/scenario_customer_support.py rename to Samples/Scenarios/scenario_customer_support.py diff --git a/Samples/scenario_memory_reconciliation.py b/Samples/Scenarios/scenario_memory_reconciliation.py similarity index 100% rename from Samples/scenario_memory_reconciliation.py rename to Samples/Scenarios/scenario_memory_reconciliation.py diff --git a/Samples/scenario_multi_agent.py b/Samples/Scenarios/scenario_multi_agent.py similarity index 100% rename from Samples/scenario_multi_agent.py rename to Samples/Scenarios/scenario_multi_agent.py diff --git a/Samples/scenario_rag_with_memory.py b/Samples/Scenarios/scenario_rag_with_memory.py similarity index 100% rename from Samples/scenario_rag_with_memory.py rename to Samples/Scenarios/scenario_rag_with_memory.py diff --git a/Samples/scenario_remote_processor.py b/Samples/Scenarios/scenario_remote_processor.py similarity index 100% rename from Samples/scenario_remote_processor.py rename to Samples/Scenarios/scenario_remote_processor.py diff --git a/Samples/scenario_remote_processor_async.py b/Samples/Scenarios/scenario_remote_processor_async.py similarity index 100% rename from Samples/scenario_remote_processor_async.py rename to Samples/Scenarios/scenario_remote_processor_async.py diff --git a/Samples/scenario_tagging_and_filtering.py b/Samples/Scenarios/scenario_tagging_and_filtering.py similarity index 100% rename from Samples/scenario_tagging_and_filtering.py rename to Samples/Scenarios/scenario_tagging_and_filtering.py