Skip to content

Commit

Permalink
Bug fixes in classifiers. Also addressed issues with free models not …
Browse files Browse the repository at this point in the history
…returning a

response.

Models can now have classifiers local to themself. For example, Koiki will
evaluate emotions, while Overmind will evaluate justice and fairness.

Changes to be committed:
	modified:   Companion
  • Loading branch information
rapmd73 committed Nov 26, 2024
1 parent 50367fb commit 5b1875a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Companion
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ from googleapiclient.discovery import build

# Active version

Version="0.0.0.0.1080"
Version="0.0.0.0.1090"

# The running name of the program. Must be global and NEVER changing.

Expand Down Expand Up @@ -473,7 +473,10 @@ def CalculateEmotionalScore(fn,gid,bot,buff,text):
# Figure out Emotional Score
escore=0
if os.path.exists(fn):
escore=float(ReadFile(fn).strip())
try:
escore=float(ReadFile(fn).strip())
except:
pass

lval,rval=CalculateMinorScale(escore)
mscore=0
Expand Down Expand Up @@ -717,6 +720,8 @@ async def AIClassifier(gid,classifier,text,FailResp="No",lval=None,rval=None):
else:
ErrorLog(f"Invalid classifier engine: {provider}")
return FailResp
if response==None:
return FailResp
return response

# This function scans a piece of text to identify sensitive personal information, such
Expand Down Expand Up @@ -1527,6 +1532,11 @@ def GetOpenAI(apikey,messages,model,freqpenalty,temperature,timeout):
RawLog(f"OpenAI/{model}: {str(completion)}")
return response

# Special note: meta-llama/llama-3.1-405b-instruct:free can cause errors by not
# returning a response. function_trapper DOES it job well, but it does looks like a
# program error. When using the free models, ALWAYS have multiple. Free means BUSY
# and a high probability is the model not responding.

@function_trapper(None)
def GetOpenRouter(apikey,messages,model,freqpenalty,temperature,timeout):
clientAI=openai.OpenAI(api_key=apikey,base_url="https://openrouter.ai/api/v1")
Expand Down

0 comments on commit 5b1875a

Please sign in to comment.