Skip to content

Commit

Permalink
[fix]: checking if emebedding is None by explicity comparision rather…
Browse files Browse the repository at this point in the history
… than using 'not' which gives numpy ambiguity error (#502)
  • Loading branch information
keenborder786 authored Aug 4, 2023
1 parent 58de7f5 commit 03dda8f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gptcache/similarity_evaluation/np.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def evaluation(
if 'question' in src_dict and 'question' in cache_dict:
if src_dict['question'].lower() == cache_dict['question'].lower():
return self.range()[1]
if 'embedding' not in src_dict or 'embedding' not in cache_dict or not src_dict['embedding'] or not cache_dict['embedding']:
if 'embedding' not in src_dict or 'embedding' not in cache_dict or src_dict['embedding'] is None or cache_dict['embedding'] is None:
assert self.question_encoder, 'You need to a valid question_embedding_function to generate question embedding in the evaluator.'
src_dict['embedding'] = self.question_encoder(src_dict['question'])
cache_dict['embedding'] = self.question_encoder(cache_dict['question'])
Expand Down

0 comments on commit 03dda8f

Please sign in to comment.