12 ms·
This is really easy to set up - and is much more accurate than asking the LLM to predict True/False. Just feed the outputs of an embedding API into logistic re
by gdiamos 2y ago
This is really easy to set up - and is much more accurate than asking the LLM to predict True/False.
Just feed the outputs of an embedding API into logistic regression, e.g. from sklearn.
import voyageai
vo = voyageai.Client()
# This will automatically use the environment variable VOYAGE_API_KEY.
# Alternatively, you can use vo = voyageai.Client(api_key="<your secret key>")
texts = ["Sample text 1", "Sample text 2"]
result = vo.embed(texts, model="voyage-2", input_type="document")
print(result.embeddings[0])
https://scikit-learn.org/1.5/modules/generated/sklearn.linear_model.LogisticRegression.html https://scikit-learn.org/1.5/modules/generated/sklearn.linea...