iryna-kondr / scikit-llm

Seamlessly integrate LLMs into scikit-learn.
https://beastbyte.ai/
MIT License
3.38k stars 275 forks source link

added optional distance metric for KNN in DynamicFewShotGPTClassifier #92

Closed AndreasKarasenko closed 6 months ago

AndreasKarasenko commented 6 months ago

People should be able to use different distance metrics for the DynamicFewShotGPTClassifier. According to this SO answer we should use the same similarity metric that of the model. E.g. cosine for openai. I simply propagated the metric variable up to DynamicFewShotGPTClassifier and tested it with the example from the documentation.

AndreasKarasenko commented 6 months ago

I added a change for #90 in the second commit. From what I can tell the predict function is handled by the BaseClassifier mixin and we can simply cast to np.array.