jblocher commited on
Commit
4fe35f0
·
1 Parent(s): 8701a63

added api_calling function

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -40,12 +40,18 @@ reflections reveal a change or growth in thinking.
40
 
41
  # Function Definitions
42
 
43
- # 1. CustomChatGPT:
44
- # This function takes a user's message as input, preprocesses the message,
45
- # interacts with the OpenAI GPT-3 model, and returns the model's response.
46
- # It manages the conversational context/history and ensures that the
47
- # conversation flows naturally.
48
-
 
 
 
 
 
 
49
 
50
  def message_and_history(input, history):
51
  history = history or []
 
40
 
41
  # Function Definitions
42
 
43
+ def api_calling(prompt):
44
+ completions = openai.Completion.create(
45
+ engine="text-davinci-003",
46
+ prompt=prompt,
47
+ max_tokens=1024,
48
+ n=1,
49
+ stop=None,
50
+ temperature=0.5,
51
+ )
52
+ message = completions.choices[0].text
53
+ return message
54
+
55
 
56
  def message_and_history(input, history):
57
  history = history or []