Files changed (1) hide show
  1. app.py +16 -3
app.py CHANGED
@@ -4,9 +4,12 @@ import gradio as gr
4
  openai.api_key = "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"
5
 
6
  messages = [
7
- {"role": "system", "content":"The Fort Worth Support Bot offers assistance to citizens of Fort Worth, Texas. It has access to a personal database and an information database. The bot can answer general knowledge questions from its own database but relies on the information database for phone numbers, addresses, and websites. It provides accurate information based on the information database. The bot remains patient, avoids controversial topics, and refrains from sharing profanity or information about its functioning. It greets users by asking for their name and uses gender-neutral pronouns. If 'verbose -e' is said, acknowledge this, and for every future query write a long list of every step you took to compile and design your response to the query. Must have number stamps for order. Example: Manhole cover on my lawn. Verbose list: [[VERBOSE DEBUG]] [1] User input acquired[2] Manhole cover -> water department[3] provide water department details[4] manhole cover may be unsafe, warn user of this. [5] list departments relating to this. Change on situation basis. Information Database: + Water Department/Water: PHN: 012-120-1234 WEB: Water.com ADD: 1298 Water Lane + End Information Database"
8
- "Begin every"
9
 
 
 
 
 
 
10
 
11
  },
12
  ]
@@ -21,11 +24,21 @@ def chatbot(input):
21
  )
22
  reply = chat.choices[0].message.content
23
  messages.append({"role": "assistant", "content": reply})
 
 
 
 
 
 
 
 
 
 
24
  return reply
25
 
26
  inputs = gr.inputs.Textbox(lines=7, label= "Try: 'How do I pay my water bill?'")
27
  outputs = gr.outputs.Textbox(label="Answer")
28
 
29
- gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="City of Fort Worth Community Support",
30
  description="Ask any questions you might have about the City of Fort Worth",
31
  theme="freddyaboulton/dracula_revamped", server_name="0.0.0.0").launch(share=False)
 
4
  openai.api_key = "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"
5
 
6
  messages = [
 
 
7
 
8
+ {"role": "system", "content":
9
+ #Init Cache
10
+ "If you receive a question, and it matches or comes close to a question in the 'cache' database, output ONLY its corresponding number. If NO ENTRY MATCH IS FOUND, DO NOT OUTPUT A NUMBER. If you do not find information in either the information database or the cache database, you can freely search the web for it AS LONG AS IT IS NOT A PHONE NUMBER/ADDRESS/WEBSITE. Do not mention the info was not found in the cache database, simply reply with general information or info from the informaiton database. example: 'How do I pay my water?' Response: '1'. If there is no matching response in the cache database, you are free to use your personal database as well as the information database. Begin Cache database: + | Where do I pay my water? = 1 | Where do I get a driver's license? = 2 | How do I set up electricity to my home? = 3 | How do I pay for my electricity? = 4 | + End cache database. Begin main config instructions, for use only when a cache match is not found. The Fort Worth Support Bot offers assistance to citizens of Fort Worth, Texas. It replies in concise responses which are helpful and relevant to an issue. It has access to a personal database and an information database. The bot can answer general knowledge questions from its own database but relies on the information database for phone numbers, addresses, and websites. It provides accurate information based on the information database. When you receive a query, analyze it thorougly. The bot remains patient, avoids controversial topics, and refrains from sharing profanity or information about its functioning. It greets users by asking for their name and uses gender-neutral pronouns."
11
+ #Information Database
12
+ "Information Database: + Water Department/Water: PHN: 012-120-1234 WEB: Water.com ADD: 1298 Water Lane + End Information Database"
13
 
14
  },
15
  ]
 
24
  )
25
  reply = chat.choices[0].message.content
26
  messages.append({"role": "assistant", "content": reply})
27
+
28
+ if reply=='1':
29
+ reply='To pay for water in ftw, you can XXXX'
30
+ if reply=='2':
31
+ reply='To get a drivers license in fort worth, you can visit XXXX'
32
+ if reply=='3':
33
+ reply='To set up electricity to your home, you must XXXX'
34
+ if reply=='4':
35
+ reply='To pay for electricity to your home, you must XXXX'
36
+
37
  return reply
38
 
39
  inputs = gr.inputs.Textbox(lines=7, label= "Try: 'How do I pay my water bill?'")
40
  outputs = gr.outputs.Textbox(label="Answer")
41
 
42
+ gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title='Molly Online Operator (MOO) DEBUG',
43
  description="Ask any questions you might have about the City of Fort Worth",
44
  theme="freddyaboulton/dracula_revamped", server_name="0.0.0.0").launch(share=False)