JarvisLabs commited on
Commit
c66551b
β€’
1 Parent(s): c575e58

Update langchain_bot.py

Browse files
Files changed (1) hide show
  1. 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=settings["prompt_temp"], # γƒ—γƒ­γƒ³γƒ—γƒˆγƒ†γƒ³γƒ—γƒ¬γƒΌγƒˆγ‚’γ‚»γƒƒγƒˆ
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