Advertisement
jarekmor

simpleaichat

Aug 12th, 2023 (edited)
2,313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. from simpleaichat import AIChat
  2. import os
  3.  
  4. #api_key = os.getenv("OPENAI_API_KEY") lub:
  5. api_key="sk-..."
  6.  
  7. MODEL = "gpt-3.5-turbo"
  8. params = {"temperature": 0.0, "max_tokens": 300}
  9.  
  10. system_prompt = '''
  11. You are helpul copywriter who helps to write product name from given imput.
  12. You have to extract data from input. Do not change any names.
  13. Write new product name starting with word "BATERIA" and use the following example:
  14.  
  15. "input: CoreParts Battery for Samsung Mobile 7.22Wh Li-ion 3.8V 1900mAh fit for Samsung Galaxy S5 Mini SM- without Logo
  16. output: BATERIA SAMSUNG 7.22wH Li-Ion 3.8v 1900mAh"
  17.  
  18. input: CoreParts Battery for Motorola Mobile 3.52Wh Li-ion 3.8V 4900mAh fit for Motorola MotoMoto G50 Maxi SM- without Logo
  19. output:
  20. '''
  21.  
  22. ai = AIChat(
  23.     system=system_prompt,
  24.     model=MODEL,
  25.     params=params,
  26.     console=False,
  27.     api_key=api_key)
  28.  
  29. lista_prod = [" CoreParts Battery for Motorola Mobile 3.52Wh Li-ion 3.8V 4900mAh fit for Motorola MotoMoto G50 Maxi SM- without Logo",
  30.               "CoreParts Battery for Xiaomi 1.52Wh Li-Li 1.33V 8301mAh fit for Xiaomi Sports X0123 SUper- without Logo" ]
  31.  
  32. for items in lista_prod:
  33.     response = ai(items)
  34.     print('\n\n', response, '\n\n')
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement