|
- from connection import *
-
- import sys
- import openai
-
-
- class Talk:
- max_tokens_count: int = 100
- responses_count: int = 1
- temperature: float = .7
- top_p: int = 1
-
- @classmethod
- def main (cls, message: str) -> None:
- openai.organization = OPENAI_ORGANISATION
- openai.api_key = OPENAI_API_KEY
-
- print (cls.__get_answers (message)[0])
-
- @classmethod
- def __get_answers (cls, message: str) -> list[str]:
- return openai.Completion.create (
- engine = 'text-davinci-002',
- prompt = message,
- max_tokens = cls.max_tokens_count,
- n = cls.temperature,
- stop = None,
- temperature = cls.temperature,
- top_p = cls.top_p).choices
-
-
- if __name__ == '__main__':
- Talk.main (sys.argv[1] if len (sys.argv) > 1 else '')
|