self._temp=0.6# Higher value means more random, lower value means more likely to be a coherent sentence
self._top_p=0.9# 1 is equivalent to greedy sampling, 0.1 means that the model will only consider the top 10% of the probability distribution
self._max_tokens=3000 # The maximum number of tokens the model can generate
self._max_tokens=4000 # The maximum number of tokens the model can generate
self._presence_penalty=0# Penalize new tokens based on whether they appear in the text so far
self._frequency_penalty=0# Penalize new tokens based on their existing frequency in the text so far. (Higher frequency = lower probability of being chosen.)
self._best_of=1# Number of responses to compare the loglikelihoods of
@ -144,7 +151,7 @@ class Model:
self.max_tokens=1900
else:
self._model=Models.DAVINCI
self.max_tokens=3000
self.max_tokens=4000
@property
defmodel(self):
@ -270,13 +277,16 @@ class Model:
raiseValueError("Prompt must be greater than 25 characters, it is currently "+str(len(prompt)))
print("The prompt about to be sent is "+prompt)
prompt_tokens=usage_service.count_tokens(prompt)
print(f"The prompt tokens will be {prompt_tokens}")
print(f"The total max tokens will then be {self.max_tokens-prompt_tokens}")
response=openai.Completion.create(
model=Models.DAVINCIifany(role.nameinDAVINCI_ROLESforroleinmessage.author.roles)elseself.model,# Davinci override for admin users