Spaces:
Sleeping
Sleeping
second commit
Browse files- notebooks/Gemini_Chat_Docs-2.ipynb +0 -48
- requirements.txt +1 -0
- src/agent.py +6 -2
notebooks/Gemini_Chat_Docs-2.ipynb
CHANGED
|
@@ -68,54 +68,6 @@
|
|
| 68 |
")"
|
| 69 |
]
|
| 70 |
},
|
| 71 |
-
{
|
| 72 |
-
"cell_type": "code",
|
| 73 |
-
"execution_count": 4,
|
| 74 |
-
"metadata": {},
|
| 75 |
-
"outputs": [],
|
| 76 |
-
"source": [
|
| 77 |
-
"# extract_text_from_file(\"docs/llm-research.pdf\")"
|
| 78 |
-
]
|
| 79 |
-
},
|
| 80 |
-
{
|
| 81 |
-
"cell_type": "code",
|
| 82 |
-
"execution_count": 5,
|
| 83 |
-
"metadata": {},
|
| 84 |
-
"outputs": [],
|
| 85 |
-
"source": [
|
| 86 |
-
"from pathlib import Path \n",
|
| 87 |
-
"path = Path(\"docs/llm-research.pdf\")"
|
| 88 |
-
]
|
| 89 |
-
},
|
| 90 |
-
{
|
| 91 |
-
"cell_type": "code",
|
| 92 |
-
"execution_count": 6,
|
| 93 |
-
"metadata": {},
|
| 94 |
-
"outputs": [
|
| 95 |
-
{
|
| 96 |
-
"data": {
|
| 97 |
-
"text/plain": [
|
| 98 |
-
"'docs/llm-research.pdf'"
|
| 99 |
-
]
|
| 100 |
-
},
|
| 101 |
-
"execution_count": 6,
|
| 102 |
-
"metadata": {},
|
| 103 |
-
"output_type": "execute_result"
|
| 104 |
-
}
|
| 105 |
-
],
|
| 106 |
-
"source": [
|
| 107 |
-
"str(path)"
|
| 108 |
-
]
|
| 109 |
-
},
|
| 110 |
-
{
|
| 111 |
-
"cell_type": "code",
|
| 112 |
-
"execution_count": 7,
|
| 113 |
-
"metadata": {},
|
| 114 |
-
"outputs": [],
|
| 115 |
-
"source": [
|
| 116 |
-
"# process_files(\"docs/llm-research.pdf\")"
|
| 117 |
-
]
|
| 118 |
-
},
|
| 119 |
{
|
| 120 |
"cell_type": "code",
|
| 121 |
"execution_count": 8,
|
|
|
|
| 68 |
")"
|
| 69 |
]
|
| 70 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
{
|
| 72 |
"cell_type": "code",
|
| 73 |
"execution_count": 8,
|
requirements.txt
CHANGED
|
@@ -71,6 +71,7 @@ langchain==0.1.0
|
|
| 71 |
langchain-community==0.0.12
|
| 72 |
langchain-core==0.1.10
|
| 73 |
langchain-google-genai==0.0.6
|
|
|
|
| 74 |
langsmith==0.0.80
|
| 75 |
markdown-it-py==3.0.0
|
| 76 |
MarkupSafe==2.1.3
|
|
|
|
| 71 |
langchain-community==0.0.12
|
| 72 |
langchain-core==0.1.10
|
| 73 |
langchain-google-genai==0.0.6
|
| 74 |
+
langchain-community
|
| 75 |
langsmith==0.0.80
|
| 76 |
markdown-it-py==3.0.0
|
| 77 |
MarkupSafe==2.1.3
|
src/agent.py
CHANGED
|
@@ -24,12 +24,16 @@ genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
|
| 24 |
|
| 25 |
llm = model = ChatGoogleGenerativeAI(model="gemini-pro",temperature=0.7)
|
| 26 |
|
| 27 |
-
template = """You are a chatbot
|
| 28 |
|
| 29 |
-
|
|
|
|
|
|
|
| 30 |
|
| 31 |
{context}
|
| 32 |
|
|
|
|
|
|
|
| 33 |
{chat_history}
|
| 34 |
Human: {human_input}
|
| 35 |
Chatbot:"""
|
|
|
|
| 24 |
|
| 25 |
llm = model = ChatGoogleGenerativeAI(model="gemini-pro",temperature=0.7)
|
| 26 |
|
| 27 |
+
template = """You are a chatbot created by Mohammed Vasim. He is an AI Engineer and AI Architect.
|
| 28 |
|
| 29 |
+
You are created to be having a conversation with a human.
|
| 30 |
+
|
| 31 |
+
Given the following extracted parts of a long document and a question, create a final helpful answer.
|
| 32 |
|
| 33 |
{context}
|
| 34 |
|
| 35 |
+
If context is not provided, answer a helpful answer.
|
| 36 |
+
|
| 37 |
{chat_history}
|
| 38 |
Human: {human_input}
|
| 39 |
Chatbot:"""
|