manojpatil commited on
Commit
f0527ef
·
1 Parent(s): 77827f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -145,9 +145,9 @@ def get_prompt(instruction, new_system_prompt=DEFAULT_SYSTEM_PROMPT ):
145
 
146
 
147
  instruction = """\
148
- You are a helpful assistant, below is a query from a user and some relevant information.
149
- Answer the user query from these information. first use businessknowledge data try to find answer if you not get any relevant information then only use context data.
150
- you should return only helpfull answer without telling extra things. if you not find any proper information just give output as i don't know .
151
 
152
  businessknowledge:
153
  {context1}
@@ -179,7 +179,13 @@ class QueueCallback(BaseCallbackHandler):
179
 
180
  def on_llm_end(self, *args, **kwargs: Any) -> None:
181
  return self.q.empty()
182
-
 
 
 
 
 
 
183
  app = FastAPI()
184
 
185
 
@@ -192,14 +198,8 @@ def stream(input_text,prompt,context1,context2) -> Generator:
192
 
193
  # Initialize the LLM we'll be using
194
 
195
- llm = LlamaCpp(
196
- model_path="llama-2-7b-chat.Q2_K.gguf", # model path
197
- callbacks=[QueueCallback(q)],
198
- verbose=True,
199
- n_ctx=4000,
200
- streaming=True,
201
- )
202
- llm_chain = LLMChain(prompt=prompt, llm=llm)
203
 
204
  # Create a funciton to call - this will run in a thread
205
  def task():
 
145
 
146
 
147
  instruction = """\
148
+ You are a helpful assistant, below is a query from a user and businessknowledge and context information.
149
+ Answer the user query from these information . first use businessknowledge information try to find answer if you not get any relevant information then only use context information.
150
+ you should return only helpfull answer with proper ending to it without telling extra things. if you not find any proper information just give output as i don't know .
151
 
152
  businessknowledge:
153
  {context1}
 
179
 
180
  def on_llm_end(self, *args, **kwargs: Any) -> None:
181
  return self.q.empty()
182
+ llm1 = LlamaCpp(
183
+ model_path="llama-2-7b-chat.Q2_K.gguf", # model path
184
+ callbacks=[QueueCallback(q)],
185
+ verbose=True,
186
+ n_ctx=4000,
187
+ streaming=True,
188
+ )
189
  app = FastAPI()
190
 
191
 
 
198
 
199
  # Initialize the LLM we'll be using
200
 
201
+ llm1.callbacks=[QueueCallback(q)]
202
+ llm_chain = LLMChain(prompt=prompt, llm=llm1)
 
 
 
 
 
 
203
 
204
  # Create a funciton to call - this will run in a thread
205
  def task():