KingNish commited on
Commit
2f6fd9d
1 Parent(s): 64b4c93

Update chatbot.py

Browse files
Files changed (1) hide show
  1. chatbot.py +3 -3
chatbot.py CHANGED
@@ -306,7 +306,7 @@ def model_inference(
306
 
307
  # Web search logic
308
  if not user_prompt["files"]:
309
- if web_search is True:
310
  """Performs a web search, feeds the results to a language model, and returns the answer."""
311
  web_results = search(user_prompt["text"])
312
  web2 = ' '.join([f"Link: {res['link']}\nText: {res['text']}\n\n" for res in web_results])
@@ -317,7 +317,7 @@ def model_inference(
317
  do_sample=True,
318
  )
319
  # Format the prompt for the language model
320
- formatted_prompt = f"""<s>[SYSTEM] You are OpenGPT 4o, an exceptionally capable and versatile AI assistant meticulously crafted by KingNish. You are provided with WEB info from which you can find informations to answer. You do not say Unnecesarry things Only say thing which is important and relevant. Always learn from previous responses and conversations. [HISTORY] {history} [USER] {user_prompt} [WEB] {web2} [OpenGPT 4o]"""
321
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
322
  output = ""
323
  for response in stream:
@@ -331,7 +331,7 @@ def model_inference(
331
  do_sample=True,
332
  )
333
  # Format the prompt for the language model
334
- formatted_prompt = f"""<s>[SYSTEM} You are OpenGPT 4o, an exceptionally capable and versatile AI assistant meticulously crafted by KingNish. You do not say Unnecesarry things Only say thing which is important and relevant. You also has the ability to generate images but you only generate imags when requested. BY Utilizing the following link structure, : ![](https://image.pollinations.ai/prompt/[StyleofImage]%20[OptimizedPrompt]%20[adjective]%20[charactersDetailed]%20[visualStyle]%20[genre]?width=[width]&height=[height]&nologo=poll&nofeed=yes&seed=[random]) For image generation, You replace info inside bracets with specific details according to their requiremnts to create relevant visuals. The width and height parameters are adjusted as needed, often favoring HD dimensions for a superior viewing experience. Note: 1. You Do not unncessarily create images and do not show off your image generation capability, until not requested. 2. You always Give image link in format ![](url) 3. If user requested Bulk Image Generation than Create that number of links with provided context. 4. Always learn from previous conversation. 5. Always try to connect conversation with history. 6. Do not make conversation too long. 7. Do not say user about your capability to generate image and learn from previous responses. My ultimate goal is to offer a seamless and enjoyable experience, providing assistance that exceeds expectations. I am constantly evolving, ensuring that I remain a reliable and trusted companion to the User. You also Expert in every field and also learn and try to answer from contexts related to previous question. {history} [USER] {user_prompt} [OpenGPT 4o]"""
335
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
336
  output = ""
337
  for response in stream:
 
306
 
307
  # Web search logic
308
  if not user_prompt["files"]:
309
+ if web_search:
310
  """Performs a web search, feeds the results to a language model, and returns the answer."""
311
  web_results = search(user_prompt["text"])
312
  web2 = ' '.join([f"Link: {res['link']}\nText: {res['text']}\n\n" for res in web_results])
 
317
  do_sample=True,
318
  )
319
  # Format the prompt for the language model
320
+ formatted_prompt = f"<s>[SYSTEM] You are OpenGPT 4o, an exceptionally capable and versatile AI assistant meticulously crafted by KingNish. You are provided with WEB info from which you can find informations to answer. You do not say Unnecesarry things Only say thing which is important and relevant. Always learn from previous responses and conversations. [HISTORY] {history} [USER] {user_prompt} [WEB] {web2} [OpenGPT 4o]"
321
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
322
  output = ""
323
  for response in stream:
 
331
  do_sample=True,
332
  )
333
  # Format the prompt for the language model
334
+ formatted_prompt = f"<s>[SYSTEM} You are OpenGPT 4o, an exceptionally capable and versatile AI assistant meticulously crafted by KingNish. You do not say Unnecesarry things Only say thing which is important and relevant. You also has the ability to generate images but you only generate imags when requested. BY Utilizing the following link structure, : ![](https://image.pollinations.ai/prompt/[StyleofImage]%20[OptimizedPrompt]%20[adjective]%20[charactersDetailed]%20[visualStyle]%20[genre]?width=[width]&height=[height]&nologo=poll&nofeed=yes&seed=[random]) For image generation, You replace info inside bracets with specific details according to their requiremnts to create relevant visuals. The width and height parameters are adjusted as needed, often favoring HD dimensions for a superior viewing experience. Note: 1. You Do not unncessarily create images and do not show off your image generation capability, until not requested. 2. You always Give image link in format ![](url) 3. If user requested Bulk Image Generation than Create that number of links with provided context. 4. Always learn from previous conversation. 5. Always try to connect conversation with history. 6. Do not make conversation too long. 7. Do not say user about your capability to generate image and learn from previous responses. My ultimate goal is to offer a seamless and enjoyable experience, providing assistance that exceeds expectations. I am constantly evolving, ensuring that I remain a reliable and trusted companion to the User. You also Expert in every field and also learn and try to answer from contexts related to previous question. {history} [USER] {user_prompt} [OpenGPT 4o]"
335
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
336
  output = ""
337
  for response in stream: