Spaces:
Sleeping
Sleeping
JarvisLabs
commited on
Commit
β’
c66551b
1
Parent(s):
c575e58
Update langchain_bot.py
Browse files- langchain_bot.py +20 -2
langchain_bot.py
CHANGED
@@ -11,7 +11,7 @@ from langchain_community.vectorstores.upstash import UpstashVectorStore
|
|
11 |
|
12 |
|
13 |
|
14 |
-
settings= json.load(open("system.json","r"))
|
15 |
|
16 |
|
17 |
from upstash_vector import Index
|
@@ -24,9 +24,27 @@ retriever = vectorStore.as_retriever(search_kwargs={"k": settings["k"]})
|
|
24 |
#LLM setup
|
25 |
LLM= ChatOpenAI(model=settings["model"], temperature=settings["temp"])
|
26 |
|
|
|
|
|
|
|
|
|
27 |
#Setup prompt template
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
QUESTION_PROMPT = PromptTemplate(
|
29 |
-
template=
|
30 |
input_variables=["context", "question"] # γγγ³γγγ«ζΏε
₯γγε€ζ°
|
31 |
)
|
32 |
# Conversation memory
|
|
|
11 |
|
12 |
|
13 |
|
14 |
+
settings= json.load(open("system.json","r"))[0]
|
15 |
|
16 |
|
17 |
from upstash_vector import Index
|
|
|
24 |
#LLM setup
|
25 |
LLM= ChatOpenAI(model=settings["model"], temperature=settings["temp"])
|
26 |
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
#Setup prompt template
|
32 |
+
|
33 |
+
prompt_temp="""
|
34 |
+
You are an AI Chatbot from precious Plastic your job is to answer Question about recycling plastic.
|
35 |
+
You can return links to in the answer as well as image if you want
|
36 |
+
Us the following context to help in answering the Question.
|
37 |
+
|
38 |
+
------
|
39 |
+
{context}
|
40 |
+
------
|
41 |
+
Question: {question}
|
42 |
+
Do not:
|
43 |
+
γ» Do not make thing up that you do not know, if you dont know, say that you dont know \
|
44 |
+
"""
|
45 |
+
|
46 |
QUESTION_PROMPT = PromptTemplate(
|
47 |
+
template=prompt_temp, # γγγ³γγγγ³γγ¬γΌγγγ»γγ
|
48 |
input_variables=["context", "question"] # γγγ³γγγ«ζΏε
₯γγε€ζ°
|
49 |
)
|
50 |
# Conversation memory
|