Minor change to upgrade libs

This commit is contained in:
Lance Martin
2024-05-26 15:14:04 -07:00
parent 9dd7f9d7f2
commit 5435ff6f7f
+40 -36
View File
@@ -60,7 +60,7 @@
"metadata": {},
"outputs": [],
"source": [
"! pip install langchain_community tiktoken langchain-openai langchainhub chromadb langchain langgraph"
"! pip install -U langchain_community tiktoken langchain-openai langchainhub chromadb langchain langgraph"
]
},
{
@@ -159,10 +159,18 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 2,
"id": "1fafad21-60cc-483e-92a3-6a7edb1838e3",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/rlm/miniforge3/envs/llama2/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:119: LangChainDeprecationWarning: The method `BaseRetriever.get_relevant_documents` was deprecated in langchain-core 0.1.46 and will be removed in 0.3.0. Use invoke instead.\n",
" warn_deprecated(\n"
]
},
{
"name": "stdout",
"output_type": "stream",
@@ -215,7 +223,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"id": "dcd77cc1-4587-40ec-b633-5364eab9e1ec",
"metadata": {},
"outputs": [
@@ -223,7 +231,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"The design of generative agents combines LLM with memory, planning, and reflection mechanisms to enable agents to behave conditioned on past experience. Long-term memory provides the agent with the capability to retain and recall infinite information over extended periods. Short-term memory is utilized for in-context learning.\n"
"The design of generative agents combines LLM with memory, planning, and reflection mechanisms to enable agents to behave conditioned on past experience and interact with other agents. Long-term memory provides the agent with the capability to retain and recall infinite information over extended periods. Short-term memory is utilized for in-context learning.\n"
]
}
],
@@ -255,7 +263,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 4,
"id": "e78931ec-940c-46ad-a0b2-f43f953f1fd7",
"metadata": {},
"outputs": [
@@ -265,7 +273,7 @@
"GradeHallucinations(binary_score='yes')"
]
},
"execution_count": 7,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
@@ -303,7 +311,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 5,
"id": "bd62276f-bf26-40d0-8cff-e07b10e00321",
"metadata": {},
"outputs": [
@@ -313,7 +321,7 @@
"GradeAnswer(binary_score='yes')"
]
},
"execution_count": 8,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
@@ -403,7 +411,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 7,
"id": "f1617e9e-66a8-4c1a-a1fe-cc936284c085",
"metadata": {},
"outputs": [],
@@ -429,7 +437,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 8,
"id": "add509d8-6682-4127-8d95-13dd37d79702",
"metadata": {},
"outputs": [],
@@ -609,7 +617,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 10,
"id": "0e09ca9f-e36d-4ef4-a0d5-79fdbada9fe0",
"metadata": {},
"outputs": [],
@@ -645,14 +653,14 @@
" \"not useful\": \"transform_query\",\n",
" },\n",
")\n",
"ß\n",
"\n",
"# Compile\n",
"app = workflow.compile()"
]
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 11,
"id": "fb69dbb9-91ee-4868-8c3c-93af3cd885be",
"metadata": {},
"outputs": [
@@ -668,24 +676,22 @@
"---GRADE: DOCUMENT RELEVANT---\n",
"---GRADE: DOCUMENT NOT RELEVANT---\n",
"---GRADE: DOCUMENT RELEVANT---\n",
"\"Node 'grade_documents':\"\n",
"'\\n---\\n'\n",
"---ASSESS GRADED DOCUMENTS---\n",
"---DECISION: GENERATE---\n",
"---GENERATE---\n",
"\"Node 'generate':\"\n",
"\"Node 'grade_documents':\"\n",
"'\\n---\\n'\n",
"---GENERATE---\n",
"---CHECK HALLUCINATIONS---\n",
"---DECISION: GENERATION IS GROUNDED IN DOCUMENTS---\n",
"---GRADE GENERATION vs QUESTION---\n",
"---DECISION: GENERATION ADDRESSES QUESTION---\n",
"\"Node '__end__':\"\n",
"\"Node 'generate':\"\n",
"'\\n---\\n'\n",
"('Short-term memory is used for in-context learning and lasts for a short '\n",
" 'period, while long-term memory allows the agent to retain and recall '\n",
" 'information over extended periods. Agents can also utilize external tools '\n",
" 'like APIs to access additional information not stored in their model '\n",
" 'weights.')\n"
"('Short-term memory is used for in-context learning in agents, allowing them '\n",
" 'to learn quickly. Long-term memory enables agents to retain and recall vast '\n",
" 'amounts of information over extended periods. Agents can also utilize '\n",
" 'external tools like APIs to access additional information beyond what is '\n",
" 'stored in their memory.')\n"
]
}
],
@@ -708,7 +714,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 12,
"id": "4138bc51-8c84-4b8a-8d24-f7f470721f6f",
"metadata": {},
"outputs": [
@@ -721,28 +727,26 @@
"'\\n---\\n'\n",
"---CHECK DOCUMENT RELEVANCE TO QUESTION---\n",
"---GRADE: DOCUMENT RELEVANT---\n",
"---GRADE: DOCUMENT NOT RELEVANT---\n",
"---GRADE: DOCUMENT RELEVANT---\n",
"---GRADE: DOCUMENT RELEVANT---\n",
"---GRADE: DOCUMENT RELEVANT---\n",
"\"Node 'grade_documents':\"\n",
"'\\n---\\n'\n",
"---ASSESS GRADED DOCUMENTS---\n",
"---DECISION: GENERATE---\n",
"---GENERATE---\n",
"\"Node 'generate':\"\n",
"\"Node 'grade_documents':\"\n",
"'\\n---\\n'\n",
"---GENERATE---\n",
"---CHECK HALLUCINATIONS---\n",
"---DECISION: GENERATION IS GROUNDED IN DOCUMENTS---\n",
"---GRADE GENERATION vs QUESTION---\n",
"---DECISION: GENERATION ADDRESSES QUESTION---\n",
"\"Node '__end__':\"\n",
"\"Node 'generate':\"\n",
"'\\n---\\n'\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 chain of thought reasoning.')\n"
"('Chain of thought prompting works by repeatedly prompting the model to ask '\n",
" 'follow-up questions to construct the thought process iteratively. This '\n",
" 'method can be combined with queries to search for relevant entities and '\n",
" 'content to add back into the context. It extends the thought process by '\n",
" 'exploring multiple reasoning possibilities at each step, creating a tree '\n",
" 'structure of thoughts.')\n"
]
}
],