This pull request mainly enhances the functionality of the simulated API by introducing a new feature that allows it to be used in environments with restricted network access. This is achieved by using a cached TikToken encoding file instead of retrieving it through the public internet. The changes also include updates to the README.md file to document this new feature.
Documentation updates:
README.md: Added a new section "Using the simulator with restricted network access" to explain the new feature and how to use it. Also, added the USE_TIKTOKEN_CACHE environment variable to the list of environment variables used to configure the simulated API. [1][2][3]
Code changes:
src/aoai-simulated-api/config.py: Added a new function setup_tiktoken_cache to set up the TikToken cache directory and raise an exception if the directory does not exist.
src/aoai-simulated-api/main.py: Imported the setup_tiktoken_cache function from config.py and added a new environment variable use_tiktoken_cache. If use_tiktoken_cache is set to True, the setup_tiktoken_cache function is called to set up the TikToken cache. [1][2]
This pull request mainly enhances the functionality of the simulated API by introducing a new feature that allows it to be used in environments with restricted network access. This is achieved by using a cached TikToken encoding file instead of retrieving it through the public internet. The changes also include updates to the
README.md
file to document this new feature.Documentation updates:
README.md
: Added a new section "Using the simulator with restricted network access" to explain the new feature and how to use it. Also, added theUSE_TIKTOKEN_CACHE
environment variable to the list of environment variables used to configure the simulated API. [1] [2] [3]Code changes:
src/aoai-simulated-api/config.py
: Added a new functionsetup_tiktoken_cache
to set up the TikToken cache directory and raise an exception if the directory does not exist.src/aoai-simulated-api/main.py
: Imported thesetup_tiktoken_cache
function fromconfig.py
and added a new environment variableuse_tiktoken_cache
. Ifuse_tiktoken_cache
is set toTrue
, thesetup_tiktoken_cache
function is called to set up the TikToken cache. [1] [2]