Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
use local embeddings
  • Loading branch information
jingyizhu99 committed Feb 9, 2024
commit ea51624a8c7374ef5649e4becf5e74e01dc38abf
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,11 @@ def _embed(self, texts: List[str]) -> List[List[float]]:
"""Embed the given texts."""
import numpy as np
import tiktoken
from azure.ai.resoures._index._utils import tiktoken_cache_dir

try:
encoding = tiktoken.encoding_for_model(self.model)
with tiktoken_cache_dir():
encoding = tiktoken.encoding_for_model(self.model)
except KeyError:
logger.warning("Warning: model not found. Using cl100k_base encoding.")
model = "cl100k_base"
Expand Down