伊地知ニジカ放送局だぬ゛ん゛. https://www.youtube.com/@deerjika
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
861 B

  1. from connection import *
  2. import sys
  3. import openai
  4. class Talk:
  5. max_tokens_count: int = 100
  6. responses_count: int = 1
  7. temperature: float = .7
  8. top_p: int = 1
  9. @classmethod
  10. def main (cls, message: str) -> None:
  11. openai.organization = OPENAI_ORGANISATION
  12. openai.api_key = OPENAI_API_KEY
  13. print (cls.__get_answers (message)[0])
  14. @classmethod
  15. def __get_answers (cls, message: str) -> list[str]:
  16. return openai.Completion.create (
  17. engine = 'text-davinci-002',
  18. prompt = message,
  19. max_tokens = cls.max_tokens_count,
  20. n = cls.temperature,
  21. stop = None,
  22. temperature = cls.temperature,
  23. top_p = cls.top_p).choices
  24. if __name__ == '__main__':
  25. Talk.main (sys.argv[1] if len (sys.argv) > 1 else '')