Skip to content

Commit

Permalink
TUTORIAL112
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed Aug 29, 2024
1 parent 89ec7cd commit e445f0d
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions tutorial112/main.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from langchain_community.chat_message_histories import RedisChatMessageHistory"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"history=RedisChatMessageHistory(session_id=\"user2\",url=\"redis://localhost:6379\")"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"history.add_user_message(\"hello i am bob\")\n",
"history.add_ai_message(\"hi roni how are bob\")"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[HumanMessage(content='hello i am bob'),\n",
" AIMessage(content='hi roni how are bob')]"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"history.messages"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"history.add_user_message(\"how are you\")\n",
"history.add_ai_message(\"i am good\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Binary file added tutorial112/tutorial112.pptx
Binary file not shown.

0 comments on commit e445f0d

Please sign in to comment.