Add ntbks

This commit is contained in:
Lance Martin
2024-11-05 20:52:32 -08:00
parent f5df0e98b6
commit 0fe9133bac
4 changed files with 565 additions and 1 deletions
+74
View File
@@ -0,0 +1,74 @@
# Task mAIstro
Task mAIstro allows you to track your ToDos through natural conversation:
* Tell it about yourself
* Tell it tasks you need to complete
* Update tasks easily through conversation
* Ask task mAIstro what to to next
Task mAIstro combines an agent with long-term memory to produce a highly personalized task management experience. All information can be stored locally using the LangGraph Studio Desktop App or it can be deployed to LangGraph Platform.
## Key Features
### Natural Language Interface
- Create and update tasks through natural conversation
- No need to learn specific commands or syntax
- Just chat with the assistant as you would with a human
### Smart Memory System
Task mAIstro maintains three types of memory:
1. **ToDo List**
- Tasks with descriptions
- Estimated completion times
- Deadlines
- Actionable solutions
- Status tracking
2. **User Profile**
- Remembers personal details
- Tracks preferences
- Maintains context about your life and work
3. **Update Instructions**
- Learns how you prefer tasks to be managed
- Adapts to your organizational style
- Maintains your preferences for task updates
## Quickstart
You can deploy the app locally with the LangGraph Studio Desktop App or to LangGraph Cloud.
### Locally
Populate the `.env` file with your `OPENAI_API_KEY` key:
```
cp .env.example .env
```
Download the LangGraph Studio desktop app for Mac [here](https://github.com/langchain-ai/langgraph-studio?tab=readme-ov-file#download).
Load this repository as a project in LangGraph Studio.
Start chatting with the task mAIstro!
### LangGraph Cloud
In your LangSmith account, create a new deployment with this repository's `main` branch.
Set your `OPENAI_API_KEY` as a secret when creating the deployment.
Interact with the deployment through the LangGraph Studio web UI.
Use the `ntbk/connecting_to_graph.ipynb` notebook to interact with the deployed graph via .
## Audio UX
See the `ntbk/audio_ux.ipynb` notebook for an example of how to add an audio interface to your graph.
## Learning More
See [Module 5 of our LangChain Academy Course on LangGraph](https://academy.langchain.com/courses/intro-to-langgraph) to learn how to build this app from scratch!
+377
View File
File diff suppressed because one or more lines are too long
+112
View File
@@ -0,0 +1,112 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "b1e3eaa4",
"metadata": {},
"source": [
"# Connecting To The Deployment\n",
"\n",
"Connected to the [LangSmith](https://smith.langchain.com/) deployment of `task_maistro`.\n",
"\n",
"Ensure the `LANGCHAIN_API_KEY` for the LangSmith account with your deployment is set.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f4de2831",
"metadata": {},
"outputs": [],
"source": [
"import os, getpass\n",
"\n",
"def _set_env(var: str):\n",
" # Check if the variable is set in the OS environment\n",
" env_value = os.environ.get(var)\n",
" if not env_value:\n",
" # If not set, prompt the user for input\n",
" env_value = getpass.getpass(f\"{var}: \")\n",
" \n",
" # Set the environment variable for the current process\n",
" os.environ[var] = env_value\n",
"\n",
"_set_env(\"LANGCHAIN_API_KEY\")"
]
},
{
"cell_type": "markdown",
"id": "386677ba",
"metadata": {},
"source": [
"### Graph connection\n",
"\n",
"Let's first test that we can connect to the graph. \n",
"\n",
"We can find the URL of the graph in the [LangSmith](https://smith.langchain.com/) UI.\n",
"\n",
"We get the `url` from the deployment page. "
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [],
"source": [
"from langgraph.pregel.remote import RemoteGraph\n",
"from langchain_core.messages import convert_to_messages\n",
"from langchain_core.messages import HumanMessage, SystemMessage\n",
"\n",
"# Add your deployment URL here\n",
"url = \"https://task-maistro-1b681add7a2b549499bb0cd21a7e5be4.default.us.langgraph.app\"\n",
"# Graph name is from langgraph.json\n",
"graph_name = \"task_maistro\" \n",
"# Connect to the graph\n",
"remote_graph = RemoteGraph(graph_name, url=url)"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "fc8102cc",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"================================\u001b[1m Human Message \u001b[0m=================================\n",
"\n",
"Hi I'm Lance. I live in San Francisco with my wife and have a 1 year old.\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"Hi Lance! It's great to meet you. I already have that information in my memory. How can I assist you today?\n"
]
}
],
"source": [
"# Interact with the graph\n",
"user_input = \"Hi I'm Lance. I live in San Francisco with my wife and have a 1 year old.\"\n",
"config = {\"configurable\": {\"user_id\": \"Lance\"}}\n",
"for chunk in remote_graph.stream({\"messages\": [HumanMessage(content=user_input)]}, stream_mode=\"values\", config=config):\n",
" convert_to_messages(chunk[\"messages\"])[-1].pretty_print()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d5851ecb",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
+2 -1
View File
@@ -2,4 +2,5 @@ langgraph
langchain-core
langchain-community
langchain-openai
trustcall
trustcall
ipython