camparchimedes commited on
Commit
ce90ecd
ยท
verified ยท
1 Parent(s): a202861

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -27,16 +27,18 @@ from frequently_asked_questions import instruction_text_faq, faq
27
 
28
  OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")
29
 
30
- class LLMChainConfig(BaseModel):
31
- model_config = ConfigDict(extra='allow')
32
 
33
- instruction_text_faq: str = instruction_text_faq
34
- faq: dict = faq
35
- instruction_text_priv: str = instruction_text_priv
36
- personvernspolicy_data: dict = personvernspolicy_data
37
 
38
-
 
39
 
 
40
  daysoff_assistant_template = """
41
  You are a customer support assistant (โ€™kundeservice AI assistentโ€™) for Daysoff.
42
  By default, you respond in Norwegian language, using a warm, direct, and professional tone.
@@ -54,7 +56,7 @@ Question: {question}
54
  Answer:
55
  """
56
  daysoff_assistant_prompt = PromptTemplate(
57
- input_variables=['chat_history', 'question', "instruction_text_faq", "faq", "instruction_text_priv", "personvernspolicy_data"],
58
  template=daysoff_assistant_template
59
  )
60
 
@@ -91,7 +93,7 @@ api_response_prompt = PromptTemplate(
91
  def setup_multiple_chains():
92
 
93
  llm = OpenAI(
94
- model='gpt-3.5-turbo-instruct',
95
  temperature=0.7,
96
  openai_api_key=OPENAI_API_KEY,
97
  max_tokens=2048,
@@ -120,7 +122,7 @@ def setup_multiple_chains():
120
  llm_chain = LLMChain(
121
  llm=llm,
122
  prompt=daysoff_assistant_prompt,
123
- memory=conversation_memory,
124
  )
125
 
126
 
 
27
 
28
  OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")
29
 
30
+ #class LLMChainConfig(BaseModel):
31
+ #model_config = ConfigDict(extra='allow')
32
 
33
+ #instruction_text_faq: str = instruction_text_faq
34
+ #faq: dict = faq
35
+ #instruction_text_priv: str = instruction_text_priv
36
+ #personvernspolicy_data: dict = personvernspolicy_data
37
 
38
+ faq_combined = f"{instruction_text_faq}\n\n{faq}"
39
+ privacy_combined = f"{instruction_text_priv}\n\n{personvernspolicy_data}"
40
 
41
+ # {faq_combined}, {privacy_combined}
42
  daysoff_assistant_template = """
43
  You are a customer support assistant (โ€™kundeservice AI assistentโ€™) for Daysoff.
44
  By default, you respond in Norwegian language, using a warm, direct, and professional tone.
 
56
  Answer:
57
  """
58
  daysoff_assistant_prompt = PromptTemplate(
59
+ input_variables=['chat_history', 'question],
60
  template=daysoff_assistant_template
61
  )
62
 
 
93
  def setup_multiple_chains():
94
 
95
  llm = OpenAI(
96
+ model='gpt-3.5-turbo',
97
  temperature=0.7,
98
  openai_api_key=OPENAI_API_KEY,
99
  max_tokens=2048,
 
122
  llm_chain = LLMChain(
123
  llm=llm,
124
  prompt=daysoff_assistant_prompt,
125
+ memory=conversation_memory
126
  )
127
 
128