Skip to content

Commit

Permalink
merge fix
Browse files Browse the repository at this point in the history
  • Loading branch information
primaryobjects committed Apr 13, 2023
1 parent 6dd6b1f commit da247ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
1 change: 1 addition & 0 deletions azure.yaml.template
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
azure_api_type: azure_ad
azure_api_base: your-base-url-for-azure
azure_api_version: api-version-for-azure
azure_model_map:
Expand Down
13 changes: 4 additions & 9 deletions scripts/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,12 @@ def __init__(self):

self.openai_api_key = os.getenv("OPENAI_API_KEY")
self.temperature = int(os.getenv("TEMPERATURE", "1"))
self.use_azure = False
self.use_azure = os.getenv("USE_AZURE") == 'True'
self.execute_local_commands = os.getenv('EXECUTE_LOCAL_COMMANDS', 'False') == 'True'

if self.use_azure:
self.openai_api_base = os.getenv("OPENAI_AZURE_API_BASE")
self.openai_api_version = os.getenv("OPENAI_AZURE_API_VERSION")
self.openai_deployment_id = os.getenv("OPENAI_AZURE_DEPLOYMENT_ID")
self.azure_chat_deployment_id = os.getenv("OPENAI_AZURE_CHAT_DEPLOYMENT_ID")
self.azure_embeddigs_deployment_id = os.getenv("OPENAI_AZURE_EMBEDDINGS_DEPLOYMENT_ID")
self.load_azure_config()
openai.api_type = os.getenv("OPENAI_API_TYPE", "azure")
openai.api_type = self.openai_api_type
openai.api_base = self.openai_api_base
openai.api_version = self.openai_api_version

Expand Down Expand Up @@ -126,8 +120,9 @@ def load_azure_config(self, config_file: str=AZURE_CONFIG_FILE) -> None:
config_params = yaml.load(file, Loader=yaml.FullLoader)
except FileNotFoundError:
config_params = {}
self.openai_api_base = config_params.get("azure_api_base", "")
self.openai_api_version = config_params.get("azure_api_version", "")
self.openai_api_type = os.getenv("OPENAI_API_TYPE", config_params.get("azure_api_type", "azure"))
self.openai_api_base = os.getenv("OPENAI_AZURE_API_BASE", config_params.get("azure_api_base", ""))
self.openai_api_version = os.getenv("OPENAI_AZURE_API_VERSION", config_params.get("azure_api_version", ""))
self.azure_model_to_deployment_id_map = config_params.get("azure_model_map", [])

def set_continuous_mode(self, value: bool):
Expand Down

0 comments on commit da247ca

Please sign in to comment.