Skip to content

Commit

Permalink
Responds binary classification
Browse files Browse the repository at this point in the history
  • Loading branch information
johan-t committed Jan 3, 2024
1 parent 0fc338b commit f32166f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions userInput/processUserInput.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def embedUserInput():
embedding = response.json()['data'][0]['embedding']
return embedding

def performKNNSearch(embedding, k=5):
def performKNNSearch(embedding, k=5, merge_threshold=0.5):
# Initialize the Qdrant client
client = QdrantClient(host='localhost', port=6333)

Expand All @@ -61,10 +61,13 @@ def performKNNSearch(embedding, k=5):
payload = result.payload
score = payload['score'] if 'score' in payload else 0
total_score += score

average_score = total_score / k

# Determine if the function should be merged based on the threshold
should_merge = "🎉 Merge the function 🎉" if average_score >= merge_threshold else "🙅 Do not merge the function 🙅"

return average_score
return should_merge, average_score

embed = embedUserInput()
print('Average Score:', performKNNSearch(embed))
print('Merge or no Merge?:', performKNNSearch(embed)[0])
print('Average Score:', performKNNSearch(embed)[1])

0 comments on commit f32166f

Please sign in to comment.