Browse Source

ボツ

btc-sounds
みてるぞ 1 year ago
parent
commit
8af98eb452
2 changed files with 21 additions and 2 deletions
  1. +1
    -0
      .gitignore
  2. +20
    -2
      talk.py

+ 1
- 0
.gitignore View File

@@ -1,2 +1,3 @@
/connection.py /connection.py
/__pycache__



+ 20
- 2
talk.py View File

@@ -5,12 +5,30 @@ import openai




class Talk: class Talk:
max_tokens_count: int = 100
responses_count: int = 5
temperature: float = .7
top_p: int = 1

@classmethod @classmethod
def main (message: str) -> None:
def main (cls, message: str) -> None:
openai.organization = OPENAI_ORGANISATION openai.organization = OPENAI_ORGANISATION
openai.api_key = OPENAI_API_KEY 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 (
model = '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__': if __name__ == '__main__':
Talk.main (sys.argv[1])
Talk.main (sys.argv[1] if len (sys.argv) > 1 else '')



Loading…
Cancel
Save