-
Notifications
You must be signed in to change notification settings - Fork 9
Memory Playground #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 41 out of 56 changed files in this pull request and generated no comments.
Files not reviewed (15)
- packages/memory-server/.python-version: Language not supported
- packages/memory-server/sample.env: Language not supported
- playground/.gitignore: Language not supported
- playground/index.html: Language not supported
- playground/package.json: Language not supported
- packages/memory_module/utils/teams_bot_middlware.py: Evaluated as low risk
- packages/memory_module/storage/in_memory_storage.py: Evaluated as low risk
- packages/memory_module/storage/sqlite_memory_storage.py: Evaluated as low risk
- packages/evals/benchmark_memory_module.py: Evaluated as low risk
- packages/memory_module/storage/sqlite_storage.py: Evaluated as low risk
- playground/postcss.config.js: Evaluated as low risk
- playground/README.md: Evaluated as low risk
- packages/memory-server/memory_service.py: Evaluated as low risk
- playground/src/api/memoryServer.ts: Evaluated as low risk
- packages/memory-server/README.md: Evaluated as low risk
@@ -0,0 +1,18 @@ | |||
# Memory Server | |||
FastAPI wrapper around the memory module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, do we want to consider having the wrapper as separate package so people don't need to download the related dependencies if they want to?
(Can file for discussion and close this comment if anyone agrees)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean since the wrapper is already a separate package. It's under packages/memory-server
while the memory module is under packages/memory-module
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as in, if we were publishing it, don't publish it with the rest of the code (bloat). but I'm still unclear on the publishing bit haha.
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"lucide-react": "^0.344.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary dependency. We should be using Microsoft's/Teams' fluent icons
"react-router-dom": "^6.14.2" | ||
}, | ||
"devDependencies": { | ||
"@eslint/js": "^9.9.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the js eslint since the code is in typescript?
content: string; | ||
created_at: string; | ||
updated_at: string; | ||
memory_type: 'semantic' | 'episodic'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: saving these as constants?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is helpful, but I think we should think about how this fits into the developer story. The memory module will be published as a separate package. This playground will only really come into play if the developer tries to pull this repo right?
@@ -0,0 +1,18 @@ | |||
# Memory Server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to spend too much extra time on this tool, but it would be worth considering how we could combine the efforts in the sample and this. (i.e. the sample has a web component that is really simple to show a user's memories). Just a consideration, not actionable.
@@ -0,0 +1,19 @@ | |||
# Memory Playground UI | |||
|
|||
A simple web application to easily view and interact with the memory module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth adding that this isn't meant for production
@@ -14,13 +14,12 @@ | |||
|
|||
sys.path.append(os.path.join(os.path.dirname(__file__), "..")) | |||
|
|||
from evals.helpers import Dataset, DatasetItem, load_dataset, setup_mlflow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO for later: unit tests. Same for the playground.
|
||
const DataTableBase = function (props: any) { | ||
return ( | ||
<DataTable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO for future: read up on react-data-table-component's styles for dark mode :D
}`} | ||
> | ||
<span className="dark:hidden"> | ||
<svg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally the svg should be in a different file and imported.
version = "0.1.0" | ||
description = "Add your description here" | ||
readme = "README.md" | ||
requires-python = ">=3.12" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change to
requires-python = ">=3.12" | |
requires-python = ">=3.11,<3.13" |
[project] | ||
name = "memory-server" | ||
version = "0.1.0" | ||
description = "Add your description here" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description
@@ -0,0 +1,19 @@ | |||
[project] | |||
name = "memory-server" | |||
version = "0.1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version must be directly below [project]. Just did a PR that fixed this elsewhere :D
1. Navigate to this folder in the termainl. | ||
1. Set up the dependencies by doing `pnpm install` in the root folder. | ||
1. Run `pnpm run dev` to start the application on port 5173. | ||
1. Ensure that the memory server is configured and running locally. See `packages/memory-server`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to memory server readme?
|
||
# Disclaimer | ||
|
||
Some components were taken from [TailAdmin](https://tailadmin.com/)'s free to use component package, which is under the MIT License. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you haven't already, this disclaimer should be where that code is
"devDependencies": { | ||
"@eslint/js": "^9.9.1", | ||
"@types/react": "^18.3.5", | ||
"@types/react-dom": "^18.3.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@types/react-hooks?
"target": "ES2022", | ||
"lib": ["ES2023"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ESNext for both?
"target": "ES2020", | ||
"useDefineForClassFields": true, | ||
"lib": ["ES2020", "DOM", "DOM.Iterable"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ESNext? make sure all tsconfigs match
|
||
{/* <!-- ===== Content Area Start ===== --> */} | ||
<div className="relative flex flex-1 flex-col overflow-y-auto overflow-x-hidden"> | ||
{/* <!-- ===== Header Start ===== --> */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments are messy. Is Header ever going to be more than one line?
{/* <!-- ===== Page Wrapper Start ===== --> */} | ||
<div className="flex h-screen overflow-hidden"> | ||
{/* <!-- ===== Sidebar Start ===== --> */} | ||
<Sidebar sidebarOpen={sidebarOpen} setSidebarOpen={setSidebarOpen} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sidebar seems unnecessary atm since it doesn't have anything. Title should be in main body.
@@ -0,0 +1,107 @@ | |||
import { useEffect, useRef } from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is necessary since there's only one view.
@@ -0,0 +1,18 @@ | |||
import { useEffect } from 'react' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also unnecessary since there's only one view.
@@ -0,0 +1,17 @@ | |||
import routes | |||
from fastapi import FastAPI | |||
from fastapi.middleware.cors import CORSMiddleware |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmmmmm fastapi is a very old package and not maintained. We should find a better solution for v next
|
||
return ( | ||
<div className={surroundingBoxStyle}> | ||
<div className="h-16 w-16 animate-spin rounded-full border-4 border-solid border-teams border-t-transparent"></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait, what's spinning?
{/* <!-- Hamburger Toggle BTN --> */} | ||
<button | ||
aria-controls="sidebar" | ||
onClick={(e) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor all functions outside of the jsx (use named functions)
import React from 'react'; | ||
import { Memory } from '../types'; | ||
|
||
interface DialogProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is defined multiple times - put in types file?
min={1} | ||
defaultValue={5} | ||
{...register("limit", { required: false, min: 1 })} | ||
className="p-2 rounded-md bg-white border border-gray-300 rounded-lg border-[1.5px] border-stroke bg-transparent py-3 px-5 text-black outline-none transition focus:border-teams active:border-teams disabled:cursor-default disabled:bg-whiter dark:border-form-strokedark dark:bg-form-input dark:text-white dark:focus:border-teams" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future TODO: make all classname strings variables and refactor into separate file. Exception could be components with 3 or fewer classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const ColumnTitle = (props: { title: string }) => { | ||
const { title } = props; | ||
|
||
return ( | ||
<div className="mb-1 text-gray-700 font-bold"> | ||
{title} | ||
</div> | ||
); | ||
} | ||
|
||
const CustomCell = (props: { content: string }) => { | ||
const { content } = props; | ||
|
||
return ( | ||
<div className="text-center"> | ||
{ content } | ||
</div> | ||
); | ||
} | ||
|
||
const columns = [ | ||
{ | ||
name: <ColumnTitle title="ID" />, | ||
selector: (row: Memory) => row.id, | ||
grow: 0.5, | ||
cell: (row: Memory) => <CustomCell content={row.id} /> | ||
}, | ||
{ | ||
name: <ColumnTitle title="Content" />, | ||
selector: (row: Memory) => row.content, | ||
grow: 1, | ||
}, | ||
{ | ||
name: <ColumnTitle title="Created At" />, | ||
selector: (row: Memory) => row.created_at, | ||
grow: 0.5, | ||
}, | ||
{ | ||
name: <ColumnTitle title="User Id" />, | ||
selector: (row: Memory) => row.user_id, | ||
grow: 0.5 | ||
}, | ||
{ | ||
name: <ColumnTitle title="Memory Type" />, | ||
selector: (row: Memory) => row.memory_type, | ||
grow: 0.5 | ||
}, | ||
{ | ||
name: <ColumnTitle title="Update At" />, | ||
selector: (row: Memory) => row.updated_at ?? "-", | ||
grow: 0.5, | ||
cell: (row: Memory) => <CustomCell content={row.updated_at ?? "-"} />, | ||
onClick: handleRowClick // Add onClick handler to rows | ||
}, | ||
]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally defined in separate files
65: '.65', | ||
}, | ||
backgroundImage: { | ||
video: "url('../images/video/video.png')", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this? Are all of the defined props in this file being used in the project?
"react-hook-form": "^7.54.2", | ||
"react-router-dom": "^6.14.2" | ||
}, | ||
"devDependencies": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably want prettier & prettier tailwind plugin for class sorting
}, | ||
"dependencies": { | ||
"lucide-react": "^0.344.0", | ||
"openai": "^4.77.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update version?
e.stopPropagation(); | ||
props.setSidebarOpen(!props.sidebarOpen); | ||
}} | ||
className="z-99999 block rounded-sm border border-stroke bg-white p-1.5 shadow-sm dark:border-strokedark dark:bg-boxdark lg:hidden" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
z-index 🙁
return ( | ||
<header className="sticky top-0 z-999 flex w-full bg-gray-3 dark:bg-boxdark dark:drop-shadow-none"> | ||
<div className="flex flex-grow items-center justify-between px-4 py-4 md:px-6 2xl:px-11"> | ||
<div className="flex items-center gap-2 sm:gap-4 lg:hidden"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this button show up in the UI?
aria-expanded={sidebarOpen} | ||
className="block lg:hidden" | ||
> | ||
<svg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export to assets jsx file with comment on what the svg looks like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool feature! Seems like there's still bloat, like the sidebar?
Thanks for the feedback folks, I will be looking into this a bit later since it's lower priority. |
This PR introduces two high level applications:
packages/memory-server
: A FastAPI server that wraps around the memory module and exposes core features like adding message, and retrieving memories.playground
: A simple web application to easily view and interact with the memory module.Other changes
Example
