Skip to content
Merged
Show file tree
Hide file tree
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 cache dirs
  • Loading branch information
jingyizhu99 committed Feb 9, 2024
commit 45f94fd163f3cd0faa76499f837656a81ff62bb3
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.generative.index._utils.tokens 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
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ 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
from azure.ai.resources._index._utils.tokens import tiktoken_cache_dir

try:
with tiktoken_cache_dir():
Expand Down