This commit is contained in:
Lance Martin
2024-02-23 16:32:14 -08:00
parent c4a77c4313
commit a0e4fea4ea
4 changed files with 670 additions and 50 deletions
+10 -13
View File
@@ -72,7 +72,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 1,
"id": "3a566a30-cf0e-4330-ad4d-9bf994bdfa86",
"metadata": {},
"outputs": [],
@@ -121,7 +121,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 2,
"id": "94b3945f-ef0f-458d-a443-f763903550b0",
"metadata": {},
"outputs": [],
@@ -172,7 +172,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 3,
"id": "efd639c5-82e2-45e6-a94a-6a4039646ef5",
"metadata": {},
"outputs": [],
@@ -279,7 +279,7 @@
"\n",
" # LLM with tool and enforce invocation\n",
" llm_with_tool = model.bind(\n",
" tools=[convert_to_openai_tool(grade_tool_oai)],\n",
" tools=[grade_tool_oai],\n",
" tool_choice={\"type\": \"function\", \"function\": {\"name\": \"grade\"}},\n",
" )\n",
"\n",
@@ -428,7 +428,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 4,
"id": "dedae17a-98c6-474d-90a7-9234b7c8cea0",
"metadata": {},
"outputs": [],
@@ -467,7 +467,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 5,
"id": "f5b7c2fe-1fc7-4b76-bf93-ba701a40aa6b",
"metadata": {},
"outputs": [
@@ -492,13 +492,10 @@
"'\\n---\\n'\n",
"\"Node '__end__':\"\n",
"'\\n---\\n'\n",
"('There are several types of memory in human brains, including sensory memory, '\n",
" 'which retains impressions of sensory information for a few seconds after the '\n",
" 'original stimuli have ended. Short-term memory is utilized for in-context '\n",
" 'learning, while long-term memory allows the agent to retain and recall '\n",
" 'information over extended periods by leveraging an external vector store and '\n",
" 'fast retrieval. Additionally, agents can use tool use to call external APIs '\n",
" 'for extra information that is missing from the model weights.')\n"
"('Short-term memory stores information needed for complex cognitive tasks and '\n",
" 'lasts for 20-30 seconds. Long-term memory can store information for a long '\n",
" 'time and has explicit and implicit subtypes. Sensory memory retains sensory '\n",
" 'impressions briefly after stimuli end.')\n"
]
}
],
+21 -22
View File
@@ -88,7 +88,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 7,
"id": "565a6d44-2c9f-4fff-b1ec-eea05df9350d",
"metadata": {},
"outputs": [],
@@ -183,7 +183,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "add509d8-6682-4127-8d95-13dd37d79702",
"metadata": {},
"outputs": [],
@@ -223,7 +223,7 @@
" return {\"keys\": {\"documents\": documents, \"question\": question}}\n",
"\n",
"\n",
"def generate(state):a\n",
"def generate(state):\n",
" \"\"\"\n",
" Generate answer\n",
"\n",
@@ -288,7 +288,7 @@
"\n",
" # LLM with tool and enforce invocation\n",
" llm_with_tool = model.bind(\n",
" tools=[convert_to_openai_tool(grade_tool_oai)],\n",
" tools=[grade_tool_oai],\n",
" tool_choice={\"type\": \"function\", \"function\": {\"name\": \"grade\"}},\n",
" )\n",
"\n",
@@ -444,7 +444,7 @@
"\n",
" # LLM with tool and enforce invocation\n",
" llm_with_tool = model.bind(\n",
" tools=[convert_to_openai_tool(grade_tool_oai)],\n",
" tools=[grade_tool_oai],\n",
" tool_choice={\"type\": \"function\", \"function\": {\"name\": \"grade\"}},\n",
" )\n",
"\n",
@@ -508,7 +508,7 @@
"\n",
" # LLM with tool and enforce invocation\n",
" llm_with_tool = model.bind(\n",
" tools=[convert_to_openai_tool(grade_tool_oai)],\n",
" tools=[grade_tool_oai],\n",
" tool_choice={\"type\": \"function\", \"function\": {\"name\": \"grade\"}},\n",
" )\n",
"\n",
@@ -553,7 +553,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 8,
"id": "0e09ca9f-e36d-4ef4-a0d5-79fdbada9fe0",
"metadata": {},
"outputs": [],
@@ -606,7 +606,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 9,
"id": "fb69dbb9-91ee-4868-8c3c-93af3cd885be",
"metadata": {},
"outputs": [
@@ -638,12 +638,12 @@
"---DECISION: USEFUL---\n",
"\"Node '__end__':\"\n",
"'\\n---\\n'\n",
"('Short-term memory is the stage of memory that stores information that we are '\n",
" 'currently aware of and needed to carry out complex cognitive tasks. It has a '\n",
" 'limited capacity and lasts for a short duration. Long-term memory, on the '\n",
" 'other hand, can store information for a long time and has unlimited storage '\n",
" 'capacity. It includes explicit/declarative memory for facts and events, and '\n",
" 'implicit/procedural memory for unconscious skills and routines.')\n"
"('Short-term memory stores information needed for immediate cognitive tasks '\n",
" 'and lasts for about 20-30 seconds. Long-term memory can retain information '\n",
" 'for extended periods, with subtypes including explicit (facts and events) '\n",
" 'and implicit (skills and routines) memory. Sensory memory retains sensory '\n",
" 'impressions briefly after stimuli end, while long-term memory stores '\n",
" 'information for a long time.')\n"
]
}
],
@@ -664,7 +664,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 10,
"id": "4138bc51-8c84-4b8a-8d24-f7f470721f6f",
"metadata": {},
"outputs": [
@@ -696,13 +696,12 @@
"---DECISION: USEFUL---\n",
"\"Node '__end__':\"\n",
"'\\n---\\n'\n",
"('Chain of thought prompting involves guiding the behavior of autoregressive '\n",
" 'language models by providing prompts or demonstrations that contain '\n",
" 'high-quality reasoning chains. This can be done through methods such as '\n",
" 'self-asking, interleaving retrieval with chain-of-thought reasoning, and '\n",
" 'complexity-based prompting for multi-step reasoning. These techniques aim to '\n",
" \"improve the model's ability to generate coherent and logical responses \"\n",
" 'without updating its weights.')\n"
"('Chain of thought prompting works by providing a series of prompts or '\n",
" 'demonstrations to guide the model through a reasoning process. This method '\n",
" 'involves iteratively constructing thought processes by asking follow-up '\n",
" 'questions or exploring multiple reasoning possibilities at each step. '\n",
" 'External search queries and relevant content from sources like Wikipedia can '\n",
" \"be integrated into the context to enhance the model's understanding.\")\n"
]
}
],