Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions embedders/classification/contextual.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import torch
import openai
from openai import error as openai_error
from litellm import embedding
import cohere


Expand Down Expand Up @@ -121,11 +122,11 @@ def _encode(
documents_batch = [doc.replace("\n", " ") for doc in documents_batch]
try:
if self.use_azure:
response = openai.Embedding.create(
response = embedding(
input=documents_batch, engine=self.model_name
)
else:
response = openai.Embedding.create(
response = embedding(
input=documents_batch, model=self.model_name
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in order to use cohere/replicate/other embedding models, just pass in the the model here

)
embeddings = [entry["embedding"] for entry in response["data"]]
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ tqdm
transformers>=4.6.0,<5.0.0
openai
cohere
litellm